Shop Record Bookmarklet

Developer
Size
7,448 Kb
Views
10,120

How do I make an shop record bookmarklet?

What is a shop record bookmarklet? How do you make a shop record bookmarklet? This script and codes were developed by Aaron Happe on 09 November 2022, Wednesday.

Shop Record Bookmarklet Previews

Shop Record Bookmarklet - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Shop Record Bookmarklet</title>
</head>
<body> <a href="javascript:(function(){!function(r%2Ce)%7Bif(%22function%22%3D%3Dtypeof%20define%26%26define.amd)define(%5B%5D%2Ce)%3Belse%20if(%22object%22%3D%3Dtypeof%20exports)%7Bvar%20n%3De()%3B%22object%22%3D%3Dtypeof%20module%26%26module%26%26module.exports%26%26(exports%3Dmodule.exports%3Dn)%2Cexports.randomColor%3Dn%7Delse%20r.randomColor%3De()%7D(this%2Cfunction()%7Bfunction%20r(r)%7Bvar%20e%3Do(r.hue)%2Cn%3Ds(e)%3Breturn%200%3En%26%26(n%3D360%2Bn)%2Cn%7Dfunction%20e(r%2Ce)%7Bif(%22random%22%3D%3D%3De.luminosity)return%20s(%5B0%2C100%5D)%3Bif(%22monochrome%22%3D%3D%3De.hue)return%200%3Bvar%20n%3Du(r)%2Ct%3Dn%5B0%5D%2Ca%3Dn%5B1%5D%3Bswitch(e.luminosity)%7Bcase%22bright%22%3At%3D55%3Bbreak%3Bcase%22dark%22%3At%3Da-10%3Bbreak%3Bcase%22light%22%3Aa%3D55%7Dreturn%20s(%5Bt%2Ca%5D)%7Dfunction%20n(r%2Ce%2Cn)%7Bvar%20t%3Da(r%2Ce)%2Co%3D100%3Bswitch(n.luminosity)%7Bcase%22dark%22%3Ao%3Dt%2B20%3Bbreak%3Bcase%22light%22%3At%3D(o%2Bt)%2F2%3Bbreak%3Bcase%22random%22%3At%3D0%2Co%3D100%7Dreturn%20s(%5Bt%2Co%5D)%7Dfunction%20t(r%2Ce)%7Bswitch(e.format)%7Bcase%22hsvArray%22%3Areturn%20r%3Bcase%22hslArray%22%3Areturn%20v(r)%3Bcase%22hsl%22%3Avar%20n%3Dv(r)%3Breturn%22hsl(%22%2Bn%5B0%5D%2B%22%2C%20%22%2Bn%5B1%5D%2B%22%25%2C%20%22%2Bn%5B2%5D%2B%22%25)%22%3Bcase%22hsla%22%3Avar%20t%3Dv(r)%3Breturn%22hsla(%22%2Bt%5B0%5D%2B%22%2C%20%22%2Bt%5B1%5D%2B%22%25%2C%20%22%2Bt%5B2%5D%2B%22%25%2C%20%22%2BMath.random()%2B%22)%22%3Bcase%22rgbArray%22%3Areturn%20h(r)%3Bcase%22rgb%22%3Avar%20a%3Dh(r)%3Breturn%22rgb(%22%2Ba.join(%22%2C%20%22)%2B%22)%22%3Bcase%22rgba%22%3Avar%20o%3Dh(r)%3Breturn%22rgba(%22%2Bo.join(%22%2C%20%22)%2B%22%2C%20%22%2BMath.random()%2B%22)%22%3Bdefault%3Areturn%20c(r)%7D%7Dfunction%20a(r%2Ce)%7Bfor(var%20n%3Di(r).lowerBounds%2Ct%3D0%3Bt%3Cn.length-1%3Bt%2B%2B)%7Bvar%20a%3Dn%5Bt%5D%5B0%5D%2Co%3Dn%5Bt%5D%5B1%5D%2Cu%3Dn%5Bt%2B1%5D%5B0%5D%2Cs%3Dn%5Bt%2B1%5D%5B1%5D%3Bif(e%3E%3Da%26%26u%3E%3De)%7Bvar%20c%3D(s-o)%2F(u-a)%2Cf%3Do-c*a%3Breturn%20c*e%2Bf%7D%7Dreturn%200%7Dfunction%20o(r)%7Bif(%22number%22%3D%3Dtypeof%20parseInt(r))%7Bvar%20e%3DparseInt(r)%3Bif(360%3Ee%26%26e%3E0)return%5Be%2Ce%5D%7Dif(%22string%22%3D%3Dtypeof%20r%26%26g%5Br%5D)%7Bvar%20n%3Dg%5Br%5D%3Bif(n.hueRange)return%20n.hueRange%7Dreturn%5B0%2C360%5D%7Dfunction%20u(r)%7Breturn%20i(r).saturationRange%7Dfunction%20i(r)%7Br%3E%3D334%26%26360%3E%3Dr%26%26(r-%3D360)%3Bfor(var%20e%20in%20g)%7Bvar%20n%3Dg%5Be%5D%3Bif(n.hueRange%26%26r%3E%3Dn.hueRange%5B0%5D%26%26r%3C%3Dn.hueRange%5B1%5D)return%20g%5Be%5D%7Dreturn%22Color%20not%20found%22%7Dfunction%20s(r)%7Bif(null%3D%3D%3Dd)return%20Math.floor(r%5B0%5D%2BMath.random()*(r%5B1%5D%2B1-r%5B0%5D))%3Bvar%20e%3Dr%5B1%5D%7C%7C1%2Cn%3Dr%5B0%5D%7C%7C0%3Bd%3D(9301*d%2B49297)%25233280%3Bvar%20t%3Dd%2F233280%3Breturn%20Math.floor(n%2Bt*(e-n))%7Dfunction%20c(r)%7Bfunction%20e(r)%7Bvar%20e%3Dr.toString(16)%3Breturn%201%3D%3De.length%3F%220%22%2Be%3Ae%7Dvar%20n%3Dh(r)%2Ct%3D%22%23%22%2Be(n%5B0%5D)%2Be(n%5B1%5D)%2Be(n%5B2%5D)%3Breturn%20t%7Dfunction%20f(r%2Ce%2Cn)%7Bvar%20t%3Dn%5B0%5D%5B0%5D%2Ca%3Dn%5Bn.length-1%5D%5B0%5D%2Co%3Dn%5Bn.length-1%5D%5B1%5D%2Cu%3Dn%5B0%5D%5B1%5D%3Bg%5Br%5D%3D%7BhueRange%3Ae%2ClowerBounds%3An%2CsaturationRange%3A%5Bt%2Ca%5D%2CbrightnessRange%3A%5Bo%2Cu%5D%7D%7Dfunction%20l()%7Bf(%22monochrome%22%2Cnull%2C%5B%5B0%2C0%5D%2C%5B100%2C0%5D%5D)%2Cf(%22red%22%2C%5B-26%2C18%5D%2C%5B%5B20%2C100%5D%2C%5B30%2C92%5D%2C%5B40%2C89%5D%2C%5B50%2C85%5D%2C%5B60%2C78%5D%2C%5B70%2C70%5D%2C%5B80%2C60%5D%2C%5B90%2C55%5D%2C%5B100%2C50%5D%5D)%2Cf(%22orange%22%2C%5B19%2C46%5D%2C%5B%5B20%2C100%5D%2C%5B30%2C93%5D%2C%5B40%2C88%5D%2C%5B50%2C86%5D%2C%5B60%2C85%5D%2C%5B70%2C70%5D%2C%5B100%2C70%5D%5D)%2Cf(%22yellow%22%2C%5B47%2C62%5D%2C%5B%5B25%2C100%5D%2C%5B40%2C94%5D%2C%5B50%2C89%5D%2C%5B60%2C86%5D%2C%5B70%2C84%5D%2C%5B80%2C82%5D%2C%5B90%2C80%5D%2C%5B100%2C75%5D%5D)%2Cf(%22green%22%2C%5B63%2C178%5D%2C%5B%5B30%2C100%5D%2C%5B40%2C90%5D%2C%5B50%2C85%5D%2C%5B60%2C81%5D%2C%5B70%2C74%5D%2C%5B80%2C64%5D%2C%5B90%2C50%5D%2C%5B100%2C40%5D%5D)%2Cf(%22blue%22%2C%5B179%2C257%5D%2C%5B%5B20%2C100%5D%2C%5B30%2C86%5D%2C%5B40%2C80%5D%2C%5B50%2C74%5D%2C%5B60%2C60%5D%2C%5B70%2C52%5D%2C%5B80%2C44%5D%2C%5B90%2C39%5D%2C%5B100%2C35%5D%5D)%2Cf(%22purple%22%2C%5B258%2C282%5D%2C%5B%5B20%2C100%5D%2C%5B30%2C87%5D%2C%5B40%2C79%5D%2C%5B50%2C70%5D%2C%5B60%2C65%5D%2C%5B70%2C59%5D%2C%5B80%2C52%5D%2C%5B90%2C45%5D%2C%5B100%2C42%5D%5D)%2Cf(%22pink%22%2C%5B283%2C334%5D%2C%5B%5B20%2C100%5D%2C%5B30%2C90%5D%2C%5B40%2C86%5D%2C%5B60%2C84%5D%2C%5B80%2C80%5D%2C%5B90%2C75%5D%2C%5B100%2C73%5D%5D)%7Dfunction%20h(r)%7Bvar%20e%3Dr%5B0%5D%3B0%3D%3D%3De%26%26(e%3D1)%2C360%3D%3D%3De%26%26(e%3D359)%2Ce%2F%3D360%3Bvar%20n%3Dr%5B1%5D%2F100%2Ct%3Dr%5B2%5D%2F100%2Ca%3DMath.floor(6*e)%2Co%3D6*e-a%2Cu%3Dt*(1-n)%2Ci%3Dt*(1-o*n)%2Cs%3Dt*(1-(1-o)*n)%2Cc%3D256%2Cf%3D256%2Cl%3D256%3Bswitch(a)%7Bcase%200%3Ac%3Dt%2Cf%3Ds%2Cl%3Du%3Bbreak%3Bcase%201%3Ac%3Di%2Cf%3Dt%2Cl%3Du%3Bbreak%3Bcase%202%3Ac%3Du%2Cf%3Dt%2Cl%3Ds%3Bbreak%3Bcase%203%3Ac%3Du%2Cf%3Di%2Cl%3Dt%3Bbreak%3Bcase%204%3Ac%3Ds%2Cf%3Du%2Cl%3Dt%3Bbreak%3Bcase%205%3Ac%3Dt%2Cf%3Du%2Cl%3Di%7Dvar%20h%3D%5BMath.floor(255*c)%2CMath.floor(255*f)%2CMath.floor(255*l)%5D%3Breturn%20h%7Dfunction%20v(r)%7Bvar%20e%3Dr%5B0%5D%2Cn%3Dr%5B1%5D%2F100%2Ct%3Dr%5B2%5D%2F100%2Ca%3D(2-n)*t%3Breturn%5Be%2CMath.round(n*t%2F(1%3Ea%3Fa%3A2-a)*1e4)%2F100%2Ca%2F2*100%5D%7Dvar%20d%3Dnull%2Cg%3D%7B%7D%3Bl()%3Bvar%20m%3Dfunction(a)%7Ba%3Da%7C%7C%7B%7D%2Ca.seed%26%26!d%26%26(d%3Da.seed)%3Bvar%20o%2Cu%2Ci%3Bif(null!%3D%3Da.count%26%26void%200!%3D%3Da.count)%7Bvar%20s%3Da.count%2Cc%3D%5B%5D%3Bfor(a.count%3Dnull%3Bs%3Ec.length%3B)c.push(m(a))%3Breturn%20a.count%3Ds%2Cd%3Da.seed%26%26s!%3D%3Dc.length%3Fa.seed%3Anull%2Cc%7Dreturn%20o%3Dr(a)%2Cu%3De(o%2Ca)%2Ci%3Dn(o%2Cu%2Ca)%2Ct(%5Bo%2Cu%2Ci%5D%2Ca)%7D%3Breturn%20m%7D)%3B%0A%0A%0Avar%20myBody%20%3D%20%24('body').html()%2C%0AmatchStartReg%20%3D%20%2F%3C!--%20Shop%3A%5B%5Cd%5D%7B5%7D_(%5B%5E-%5C%3E%5D%2B%3F)%20START%20--%3E%2Fig%2C%0AmatchStartReg2%20%3D%20%2F%3C!--%20Shop%3A%5B%5Cd%5D%7B5%7D_(%5B%5E-%5C%3E%5D%2B%3F)%20START%20--%3E%2Fi%2C%0AmatchEndReg%20%3D%20%2F%3C!--%20Shop%3A%5B%5Cd%5D%7B5%7D_%5B%5E-%5C%3E%5D%2B%3F%20END%20--%3E%2Fig%2C%0ArgbaReg%20%3D%20%2F0%5C.%5Cd%2B(%3F%3D%5C))%2F%2C%0AshopNameArray%20%3D%20%5B%5D%2C%0AstartColors%20%3D%20%5B%5D%2C%0AstartColors2%20%3D%20%5B%5D%2C%0AendColors1%20%3D%20%5B%5D%2C%0AendColors2%20%3D%20%5B%5D%2C%0AcolorMatch%2C%0AreplacedColor%2C%0AmatchedShop%20%3D%20myBody.match(matchStartReg)%2C%0ASrWidget%20%3D%20%22%3Cul%20class%3D'sr-widget'%20style%3D'background%3A%23ccc%3Bborder%3A1px%20solid%20%238F8F8F%3Bposition%3Afixed%3Btop%3A0%3Bright%3A0%3Bz-index%3A1001%3Bpadding%3A1.5em%3B'%3E%3C%2Ful%3E%22%2C%0AwidgClicked%20%3D%20%22clicked-sr-w%22%3B%0A%0A%2F%2Fextract%20names%0AmatchedShop.forEach(function(matched)%20%7B%0A%09var%20shop%20%3D%20matched.match(matchStartReg2)%2C%0A%09shop%20%3D%20shop%5B1%5D%2C%0A%09shop%20%3D%20shop.replace(%2F%5Cs%5C%5B%2F%2C%20'-')%2C%0A%09shop%20%3D%20shop.replace(%2F%5C%5D%2F%2C%20'')%3B%0A%09shopNameArray.push(shop)%3B%0A%7D)%3B%0A%0A%2F%2Freplace%20shop%20record%20comments%20with%20div's%0Avar%20myBody%20%3D%20myBody.replace(matchStartReg%2C%20%22%3Cdiv%20class%3D'shoprecord-tool'%20style%3D'position%3Arelative%3B'%3E%22)%2C%0AmyBody%20%3D%20myBody.replace(matchEndReg%2C%20%22%3C%2Fdiv%3E%22)%3B%0A%0Adocument.body.innerHTML%20%3D%20myBody%3B%0A%0A%2F%2Fgenerate%20colors%20(color%20generator%20plugin%20above)%0AstartColors%20%3D%20randomColor(%7B%0A%20%20%20count%3A%20shopNameArray.length%2C%0A%20%20%20luminosity%3A%20'bright'%2C%0A%20%20%20format%3A%20'rgba'%0A%7D)%3B%0A%0AstartColors2%20%3D%20startColors.slice(0)%3B%0A%0A%24.each(startColors%2C%20function()%7B%0A%09colorMatch%20%3D%20startColors.shift()%2C%0A%09replacedColor%20%3D%20colorMatch.replace(rgbaReg%2C%20'0.7')%2C%0A%09endColors1.push(replacedColor)%3B%0A%7D)%3B%0A%0A%24.each(startColors2%2C%20function()%7B%0A%09colorMatch%20%3D%20startColors2.shift()%2C%0A%09replacedColor%20%3D%20colorMatch.replace(rgbaReg%2C%20'0.1')%2C%0A%09endColors2.push(replacedColor)%3B%0A%7D)%3B%0A%0A%2F%2Fcreate%20widget%0A%24('body').prepend(SrWidget)%3B%0A%0A%24('div.shoprecord-tool').each(function()%7B%0A%09var%20shopName%20%3D%20shopNameArray.shift()%3B%0A%09widgetLi%20%3D%20%22%3Cli%20style%3D'list-style%3Anone%3Bcursor%3Apointer%3Bline-height%3A1.7em%3Bfont-size%3A12px%3B'%3E%22%20%2B%20shopName%20%2B%20%22%3C%2Fli%3E%22%3B%0A%09%24(this).addClass(shopName)%2C%0A%09endColor1%20%3D%20endColors1.shift()%2C%0A%09endColor2%20%3D%20endColors2.shift()%2C%0A%09shopRText%20%3D%20%22%3Cp%20style%3D'background-color%3A%22%20%2B%20endColor1%20%20%2B%22%3Btext-align%3Acenter%3Bmargin%3A0%3B'%3ESHOP%20RECORD%3A%20%22%20%2B%20shopName%20%2B%20%22%3C%2Fp%3E%22%2C%0A%09innerSrWrap%20%3D%20%24(this).prepend(%22%3Cdiv%20class%3D'inner-sr-tool'%20style%3D'display%3Anone%3Bposition%3Aabsolute%3Bz-index%3A25%3Btop%3A0%3Bbottom%3A0%3Bleft%3A0%3Bright%3A0%3Bbackground-color%3A%22%20%2B%20endColor2%20%20%2B%20%22%3B'%3E%22%20%2B%20shopRText%20%2B%20%22%3C%2Fdiv%3E%22)%3B%0A%09%24('.sr-widget').append(widgetLi)%3B%0A%7D)%3B%0A%0Avar%20widgetLiAllOn%20%3D%20%22%3Cli%20style%3D'list-style%3Anone%3Bcursor%3Apointer%3Bline-height%3A1.7em%3Bpadding-top%3A.5em%3Bfont-size%3A12px%3Bmargin-top%3A.5em%3Bborder-top%3A1px%20solid%20%23000%3B'class%3D'all-on'%3ETurn%20On%20All%3C%2Fli%3E%22%2C%0AwidgetLiAllOff%20%3D%20%22%3Cli%20style%3D'list-style%3Anone%3Bcursor%3Apointer%3Bline-height%3A1.7em%3Bfont-size%3A12px%3B'class%3D'all-off'%3ETurn%20Off%20All%3C%2Fli%3E%22%2C%0AwidgetLiReload%20%3D%20%22%3Cli%20style%3D'list-style%3Anone%3Bcursor%3Apointer%3Bline-height%3A1.7em%3Bposition%3Arelative%3Btop%3A-.5em%3Bleft%3A-.5em%3B'class%3D'bm-reload'%3B%3Ex%3C%2Fli%3E%22%3B%0A%24('.sr-widget').append(widgetLiAllOn).append(widgetLiAllOff).prepend(widgetLiReload)%3B%0A%0A%0A%0A%2F%2Fclick%20functionality%20%0A%24('.sr-widget%20li').each(function()%7B%0A%09%24(this).click(function()%7B%0A%09%09var%20liText%20%3D%20%24(this).text()%3B%0A%09%09if(%20!%24(this).hasClass(widgClicked)%20)%7B%0A%09%09%09%24(this).addClass(widgClicked)%3B%0A%09%09%09%24(this).css('text-decoration'%2C%20'underline')%3B%0A%09%09%09%24('div.shoprecord-tool').each(function()%7B%0A%09%09%09%09%09if%20(%24(this).hasClass(liText))%7B%0A%09%09%09%09%09%09%24(this).css('min-height'%2C%20'3em')%3B%0A%09%09%09%09%09%09%24(this).children('.inner-sr-tool').show()%3B%0A%09%09%09%09%09%7D%20%0A%09%09%09%7D)%3B%0A%09%09%7D%20else%20if(%20%24(this).hasClass(widgClicked)%20)%20%7B%0A%09%09%09%24(this).removeClass(widgClicked)%3B%0A%09%09%09%24(this).css('text-decoration'%2C%20'none')%3B%0A%09%09%09%24('div.shoprecord-tool').each(function()%7B%0A%09%09%09%09if%20(%24(this).hasClass(liText))%7B%0A%09%09%09%09%09%24(this).css('min-height'%2C%20'0em')%3B%0A%09%09%09%09%09%24(this).children('.inner-sr-tool').hide()%3B%0A%09%09%09%09%7D%20%0A%09%09%09%7D)%3B%0A%09%09%7D%0A%09%7D)%3B%0A%7D)%3B%0A%0A%2F%2Fhover%20functionality%0A%24('.sr-widget%20li').mouseenter(function()%7B%0A%09if%20(%20!%24(this).hasClass(widgClicked)%20)%7B%0A%09%09%24(this).css('text-decoration'%2C%20'underline')%3B%0A%09%09var%20liText%20%3D%20%24(this).text()%3B%0A%09%09%24('div.shoprecord-tool').each(function()%7B%0A%09%09%09%09if%20(%24(this).hasClass(liText))%7B%0A%09%09%09%09%09%24(this).css('min-height'%2C%20'3em')%3B%0A%09%09%09%09%09%24(this).children('.inner-sr-tool').show()%3B%0A%09%09%09%09%7D%20%0A%09%09%7D)%3B%0A%09%7D%0A%7D)%3B%0A%0A%24('.sr-widget%20li').mouseleave(function()%7B%0A%09if%20(%20!%24(this).hasClass(widgClicked)%20)%7B%0A%09%09%24(this).css('text-decoration'%2C%20'none')%3B%0A%09%09var%20liText%20%3D%20%24(this).text()%3B%0A%09%09%09%24('div.shoprecord-tool').each(function()%7B%0A%09%09%09%09if%20(%24(this).hasClass(liText))%7B%0A%09%09%09%09%09%24(this).css('min-height'%2C%20'0em')%3B%0A%09%09%09%09%09%24(this).children('.inner-sr-tool').hide()%3B%0A%09%09%09%09%7D%0A%09%09%09%7D)%3B%0A%09%09%7D%0A%7D)%3B%0A%0A%2F%2Fclick%20turn%20on%2Foff%20all%20functionality%0A%0A%24('.all-on').click(function()%7B%0A%09%24(this).siblings().css('text-decoration'%2C%20'none')%3B%0A%09%24('.inner-sr-tool').show()%3B%0A%09%24('div.shoprecord-tool').each(function()%7B%0A%09%09%09%24(this).css('min-height'%2C%20'3em')%3B%0A%09%7D)%3B%0A%7D)%3B%0A%0A%24('.all-off').click(function()%7B%0A%09%24(this).css('text-decoration'%2C%20'none')%3B%0A%09%24(this).siblings().css('text-decoration'%2C%20'none')%3B%0A%09%24('.inner-sr-tool').hide()%3B%0A%09%24('div.shoprecord-tool').each(function()%7B%0A%09%09%09%24(this).css('min-height'%2C%20'0')%3B%0A%09%7D)%3B%0A%7D)%3B%0A%0A%24('.bm-reload').click(function()%7B%0A%09location.reload()%3B%0A%7D)%3B}());">Show Shops</a> <script src="js/index.js"></script>
</body>
</html>

Shop Record Bookmarklet - Script Codes JS Codes

//color plugin
!function(r,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof exports){var n=e();"object"==typeof module&&module&&module.exports&&(exports=module.exports=n),exports.randomColor=n}else r.randomColor=e()}(this,function(){function r(r){var e=o(r.hue),n=s(e);return 0>n&&(n=360+n),n}function e(r,e){if("random"===e.luminosity)return s([0,100]);if("monochrome"===e.hue)return 0;var n=u(r),t=n[0],a=n[1];switch(e.luminosity){case"bright":t=55;break;case"dark":t=a-10;break;case"light":a=55}return s([t,a])}function n(r,e,n){var t=a(r,e),o=100;switch(n.luminosity){case"dark":o=t+20;break;case"light":t=(o+t)/2;break;case"random":t=0,o=100}return s([t,o])}function t(r,e){switch(e.format){case"hsvArray":return r;case"hslArray":return v(r);case"hsl":var n=v(r);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var t=v(r);return"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+Math.random()+")";case"rgbArray":return h(r);case"rgb":var a=h(r);return"rgb("+a.join(", ")+")";case"rgba":var o=h(r);return"rgba("+o.join(", ")+", "+Math.random()+")";default:return c(r)}}function a(r,e){for(var n=i(r).lowerBounds,t=0;t<n.length-1;t++){var a=n[t][0],o=n[t][1],u=n[t+1][0],s=n[t+1][1];if(e>=a&&u>=e){var c=(s-o)/(u-a),f=o-c*a;return c*e+f}}return 0}function o(r){if("number"==typeof parseInt(r)){var e=parseInt(r);if(360>e&&e>0)return[e,e]}if("string"==typeof r&&g[r]){var n=g[r];if(n.hueRange)return n.hueRange}return[0,360]}function u(r){return i(r).saturationRange}function i(r){r>=334&&360>=r&&(r-=360);for(var e in g){var n=g[e];if(n.hueRange&&r>=n.hueRange[0]&&r<=n.hueRange[1])return g[e]}return"Color not found"}function s(r){if(null===d)return Math.floor(r[0]+Math.random()*(r[1]+1-r[0]));var e=r[1]||1,n=r[0]||0;d=(9301*d+49297)%233280;var t=d/233280;return Math.floor(n+t*(e-n))}function c(r){function e(r){var e=r.toString(16);return 1==e.length?"0"+e:e}var n=h(r),t="#"+e(n[0])+e(n[1])+e(n[2]);return t}function f(r,e,n){var t=n[0][0],a=n[n.length-1][0],o=n[n.length-1][1],u=n[0][1];g[r]={hueRange:e,lowerBounds:n,saturationRange:[t,a],brightnessRange:[o,u]}}function l(){f("monochrome",null,[[0,0],[100,0]]),f("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),f("orange",[19,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),f("yellow",[47,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),f("green",[63,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),f("blue",[179,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),f("purple",[258,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),f("pink",[283,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]])}function h(r){var e=r[0];0===e&&(e=1),360===e&&(e=359),e/=360;var n=r[1]/100,t=r[2]/100,a=Math.floor(6*e),o=6*e-a,u=t*(1-n),i=t*(1-o*n),s=t*(1-(1-o)*n),c=256,f=256,l=256;switch(a){case 0:c=t,f=s,l=u;break;case 1:c=i,f=t,l=u;break;case 2:c=u,f=t,l=s;break;case 3:c=u,f=i,l=t;break;case 4:c=s,f=u,l=t;break;case 5:c=t,f=u,l=i}var h=[Math.floor(255*c),Math.floor(255*f),Math.floor(255*l)];return h}function v(r){var e=r[0],n=r[1]/100,t=r[2]/100,a=(2-n)*t;return[e,Math.round(n*t/(1>a?a:2-a)*1e4)/100,a/2*100]}var d=null,g={};l();var m=function(a){a=a||{},a.seed&&!d&&(d=a.seed);var o,u,i;if(null!==a.count&&void 0!==a.count){var s=a.count,c=[];for(a.count=null;s>c.length;)c.push(m(a));return a.count=s,d=a.seed&&s!==c.length?a.seed:null,c}return o=r(a),u=e(o,a),i=n(o,u,a),t([o,u,i],a)};return m});
var myBody = $('body').html(),
matchStartReg = /<!-- Shop:[\d]{5}_([^-\>]+?) START -->/ig,
matchStartReg2 = /<!-- Shop:[\d]{5}_([^-\>]+?) START -->/i,
matchEndReg = /<!-- Shop:[\d]{5}_[^-\>]+? END -->/ig,
rgbaReg = /0\.\d+(?=\))/,
shopNameArray = [],
startColors = [],
startColors2 = [],
endColors1 = [],
endColors2 = [],
colorMatch,
replacedColor,
matchedShop = myBody.match(matchStartReg),
SrWidget = "<ul class='sr-widget' style='background:#ccc;border:1px solid #8F8F8F;position:fixed;top:0;right:0;z-index:50;padding:1.5em;'></ul>",
widgClicked = "clicked-sr-w";
//extract names
matchedShop.forEach(function(matched) {	var shop = matched.match(matchStartReg2),	shop = shop[1],	shop = shop.replace(/\s\[/, '-'),	shop = shop.replace(/\]/, '');	shopNameArray.push(shop);
});
//replace shop record comments with div's
var myBody = myBody.replace(matchStartReg, "<div class='shoprecord-tool' style='position:relative;'>"),
myBody = myBody.replace(matchEndReg, "</div>");
document.body.innerHTML = myBody;
//generate colors (color generator plugin above)
startColors = randomColor({ count: shopNameArray.length, luminosity: 'bright', format: 'rgba'
});
startColors2 = startColors.slice(0);
$.each(startColors, function(){	colorMatch = startColors.shift(),	replacedColor = colorMatch.replace(rgbaReg, '0.7'),	endColors1.push(replacedColor);
});
$.each(startColors2, function(){	colorMatch = startColors2.shift(),	replacedColor = colorMatch.replace(rgbaReg, '0.1'),	endColors2.push(replacedColor);
});
//create widget
$('body').prepend(SrWidget);
$('div.shoprecord-tool').each(function(){	var shopName = shopNameArray.shift();	widgetLi = "<li style='list-style:none;cursor:pointer;line-height:1.7em;'>" + shopName + "</li>";	$(this).addClass(shopName),	endColor1 = endColors1.shift(),	endColor2 = endColors2.shift(),	shopRText = "<p style='background-color:" + endColor1 +";text-align:center;margin:0;'>SHOP RECORD: " + shopName + "</p>",	innerSrWrap = $(this).prepend("<div class='inner-sr-tool' style='display:none;position:absolute;z-index:25;top:0;bottom:0;left:0;right:0;background-color:" + endColor2 + ";'>" + shopRText + "</div>");	$('.sr-widget').append(widgetLi);
});
var widgetLiAllOn = "<li style='list-style:none;cursor:pointer;line-height:1.7em;padding-top:.5em;margin-top:.5em;border-top:1px solid #000;'class='all-on'>Turn On All</li>",
widgetLiAllOff = "<li style='list-style:none;cursor:pointer;line-height:1.7em;'class='all-off'>Turn Off All</li>",
widgetLiReload = "<li style='list-style:none;cursor:pointer;line-height:1.7em;position:relative;top:-.5em;left:-.5em;'class='bm-reload';>x</li>";
$('.sr-widget').append(widgetLiAllOn).append(widgetLiAllOff).prepend(widgetLiReload);
//click functionality
$('.sr-widget li').each(function(){	$(this).click(function(){	var liText = $(this).text();	if( !$(this).hasClass(widgClicked) ){	$(this).addClass(widgClicked);	$(this).css('text-decoration', 'underline');	$('div.shoprecord-tool').each(function(){	if ($(this).hasClass(liText)){	$(this).css('min-height', '3em');	$(this).children('.inner-sr-tool').show();	}	});	} else if( $(this).hasClass(widgClicked) ) {	$(this).removeClass(widgClicked);	$(this).css('text-decoration', 'none');	$('div.shoprecord-tool').each(function(){	if ($(this).hasClass(liText)){	$(this).css('min-height', '0em');	$(this).children('.inner-sr-tool').hide();	}	});	}	});
});
//hover functionality
$('.sr-widget li').mouseenter(function(){	if ( !$(this).hasClass(widgClicked) ){	$(this).css('text-decoration', 'underline');	var liText = $(this).text();	$('div.shoprecord-tool').each(function(){	if ($(this).hasClass(liText)){	$(this).css('min-height', '3em');	$(this).children('.inner-sr-tool').show();	}	});	}
});
$('.sr-widget li').mouseleave(function(){	if ( !$(this).hasClass(widgClicked) ){	$(this).css('text-decoration', 'none');	var liText = $(this).text();	$('div.shoprecord-tool').each(function(){	if ($(this).hasClass(liText)){	$(this).css('min-height', '0em');	$(this).children('.inner-sr-tool').hide();	}	});	}
});
//click turn on/off all functionality
$('.all-on').click(function(){	$(this).siblings().css('text-decoration', 'none');	$('.inner-sr-tool').show();	$('div.shoprecord-tool').each(function(){	$(this).css('min-height', '3em');	});
});
$('.all-off').click(function(){	$(this).css('text-decoration', 'none');	$(this).siblings().css('text-decoration', 'none');	$('.inner-sr-tool').hide();	$('div.shoprecord-tool').each(function(){	$(this).css('min-height', '0');	});
});
$('.bm-reload').click(function(){	location.reload();
});
Shop Record Bookmarklet - Script Codes
Shop Record Bookmarklet - Script Codes
Home Page Home
Developer Aaron Happe
Username aaronhappe
Uploaded November 09, 2022
Rating 3
Size 7,448 Kb
Views 10,120
Do you need developer help for Shop Record Bookmarklet?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Aaron Happe (aaronhappe) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!