Giter Site home page Giter Site logo

bookmarklets's Introduction

Bookmarklets

Set of useful JavaScript bookmarklets


To add bookmarklet follow these steps:

  1. Copy bookmarklet
  2. Right click on bookmarks bar
  3. Select Add page
  4. Add a name of the bookmarklet in name field
  5. Paste bookmarklet in URL field

List of Bookmarklets

Toggle Design Mode

javascript:(function(){document.designMode==='on'?document.designMode='off':document.designMode='on'})();

Show Review App QR Code

javascript:(function(){var t;!function(){function e(t){this.mode=h.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=[],r=0,o=this.data.length;o>r;r++){var n=this.data.charCodeAt(r);n>65536?(e[0]=240|(1835008&n)>>>18,e[1]=128|(258048&n)>>>12,e[2]=128|(4032&n)>>>6,e[3]=128|63&n):n>2048?(e[0]=224|(61440&n)>>>12,e[1]=128|(4032&n)>>>6,e[2]=128|63&n):n>128?(e[0]=192|(1984&n)>>>6,e[1]=128|63&n):e[0]=n,this.parsedData=this.parsedData.concat(e)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function o(t,e){if(null==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}function n(t,e){this.totalCount=t,this.dataCount=e}function i(){this.buffer=[],this.length=0}function a(){var t=!1,e=navigator.userAgent;return/android/i.test(e)&&(t=!0,aMat=e.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(t=parseFloat(aMat[1]))),t}function s(t,e){for(var r=1,o=function(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}(t),n=0,i=c.length;i>=n;n++){var a=0;switch(e){case l.L:a=c[n][0];break;case l.M:a=c[n][1];break;case l.Q:a=c[n][2];break;case l.H:a=c[n][3]}if(a>=o)break;r++}if(r>c.length)throw new Error("Too long data");return r}e.prototype={getLength:function(){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;r>e;e++)t.put(this.parsedData[e],8)}},r.prototype={addData:function(t){var r=new e(t);this.dataList.push(r),this.dataCache=null},isDark:function(t,e){if(0>t||this.moduleCount<=t||0>e||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++){this.modules[o]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[o][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;7>=r;r++)if(!(-1>=t+r||this.moduleCount<=t+r))for(var o=-1;7>=o;o++)-1>=e+o||this.moduleCount<=e+o||(this.modules[t+r][e+o]=r>=0&&6>=r&&(0==o||6==o)||o>=0&&6>=o&&(0==r||6==r)||r>=2&&4>=r&&o>=2&&4>=o)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;8>r;r++){this.makeImpl(!0,r);var o=g.getLostPoint(this);(0==r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n<this.modules.length;n++)for(var i=1*n,a=0;a<this.modules[n].length;a++){var s=1*a;this.modules[n][a]&&(o.beginFill(0,100),o.moveTo(s,i),o.lineTo(s+1,i),o.lineTo(s+1,i+1),o.lineTo(s,i+1),o.endFill())}return o},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=0==t%2);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=0==e%2)},setupPositionAdjustPattern:function(){for(var t=g.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var o=t[e],n=t[r];if(null==this.modules[o][n])for(var i=-2;2>=i;i++)for(var a=-2;2>=a;a++)this.modules[o+i][n+a]=-2==i||2==i||-2==a||2==a||0==i&&0==a}},setupTypeNumber:function(t){for(var e=g.getBCHTypeNumber(this.typeNumber),r=0;18>r;r++){var o=!t&&1==(1&e>>r);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;18>r;r++){o=!t&&1==(1&e>>r);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,o=g.getBCHTypeInfo(r),n=0;15>n;n++){var i=!t&&1==(1&o>>n);6>n?this.modules[n][8]=i:8>n?this.modules[n+1][8]=i:this.modules[this.moduleCount-15+n][8]=i}for(n=0;15>n;n++){i=!t&&1==(1&o>>n);8>n?this.modules[8][this.moduleCount-n-1]=i:9>n?this.modules[8][15-n-1+1]=i:this.modules[8][15-n-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;2>s;s++)if(null==this.modules[o][a-s]){var h=!1;i<t.length&&(h=1==(1&t[i]>>>n)),g.getMask(e,o,a-s)&&(h=!h),this.modules[o][a-s]=h,-1==--n&&(i++,n=7)}if(0>(o+=r)||this.moduleCount<=o){o-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(t,e,o){for(var a=n.getRSBlocks(t,e),s=new i,h=0;h<o.length;h++){var l=o[h];s.put(l.mode,4),s.put(l.getLength(),g.getLengthInBits(l.mode,t)),l.write(s)}var u=0;for(h=0;h<a.length;h++)u+=a[h].dataCount;if(s.getLengthInBits()>8*u)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*u+")");for(s.getLengthInBits()+4<=8*u&&s.put(0,4);0!=s.getLengthInBits()%8;)s.putBit(!1);for(;!(s.getLengthInBits()>=8*u)&&(s.put(r.PAD0,8),!(s.getLengthInBits()>=8*u));)s.put(r.PAD1,8);return r.createBytes(s,a)},r.createBytes=function(t,e){for(var r=0,n=0,i=0,a=new Array(e.length),s=new Array(e.length),h=0;h<e.length;h++){var l=e[h].dataCount,u=e[h].totalCount-l;n=Math.max(n,l),i=Math.max(i,u),a[h]=new Array(l);for(var f=0;f<a[h].length;f++)a[h][f]=255&t.buffer[f+r];r+=l;var d=g.getErrorCorrectPolynomial(u),c=new o(a[h],d.getLength()-1).mod(d);s[h]=new Array(d.getLength()-1);for(f=0;f<s[h].length;f++){var p=f+c.getLength()-s[h].length;s[h][f]=p>=0?c.get(p):0}}var m=0;for(f=0;f<e.length;f++)m+=e[f].totalCount;var _=new Array(m),v=0;for(f=0;n>f;f++)for(h=0;h<e.length;h++)f<a[h].length&&(_[v++]=a[h][f]);for(f=0;i>f;f++)for(h=0;h<e.length;h++)f<s[h].length&&(_[v++]=s[h][f]);return _};for(var h={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},l={L:1,M:0,Q:3,H:2},u={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},g={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;g.getBCHDigit(e)-g.getBCHDigit(g.G15)>=0;)e^=g.G15<<g.getBCHDigit(e)-g.getBCHDigit(g.G15);return(t<<10|e)^g.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;g.getBCHDigit(e)-g.getBCHDigit(g.G18)>=0;)e^=g.G18<<g.getBCHDigit(e)-g.getBCHDigit(g.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return g.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case u.PATTERN000:return 0==(e+r)%2;case u.PATTERN001:return 0==e%2;case u.PATTERN010:return 0==r%3;case u.PATTERN011:return 0==(e+r)%3;case u.PATTERN100:return 0==(Math.floor(e/2)+Math.floor(r/3))%2;case u.PATTERN101:return 0==e*r%2+e*r%3;case u.PATTERN110:return 0==(e*r%2+e*r%3)%2;case u.PATTERN111:return 0==(e*r%3+(e+r)%2)%2;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new o([1],0),r=0;t>r;r++)e=e.multiply(new o([1,f.gexp(r)],0));return e},getLengthInBits:function(t,e){if(e>=1&&10>e)switch(t){case h.MODE_NUMBER:return 10;case h.MODE_ALPHA_NUM:return 9;case h.MODE_8BIT_BYTE:case h.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(27>e)switch(t){case h.MODE_NUMBER:return 12;case h.MODE_ALPHA_NUM:return 11;case h.MODE_8BIT_BYTE:return 16;case h.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(41>e))throw new Error("type:"+e);switch(t){case h.MODE_NUMBER:return 14;case h.MODE_ALPHA_NUM:return 13;case h.MODE_8BIT_BYTE:return 16;case h.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),r=0,o=0;e>o;o++)for(var n=0;e>n;n++){for(var i=0,a=t.isDark(o,n),s=-1;1>=s;s++)if(!(0>o+s||o+s>=e))for(var h=-1;1>=h;h++)0>n+h||n+h>=e||(0!=s||0!=h)&&a==t.isDark(o+s,n+h)&&i++;i>5&&(r+=3+i-5)}for(o=0;e-1>o;o++)for(n=0;e-1>n;n++){var l=0;t.isDark(o,n)&&l++,t.isDark(o+1,n)&&l++,t.isDark(o,n+1)&&l++,t.isDark(o+1,n+1)&&l++,(0==l||4==l)&&(r+=3)}for(o=0;e>o;o++)for(n=0;e-6>n;n++)t.isDark(o,n)&&!t.isDark(o,n+1)&&t.isDark(o,n+2)&&t.isDark(o,n+3)&&t.isDark(o,n+4)&&!t.isDark(o,n+5)&&t.isDark(o,n+6)&&(r+=40);for(n=0;e>n;n++)for(o=0;e-6>o;o++)t.isDark(o,n)&&!t.isDark(o+1,n)&&t.isDark(o+2,n)&&t.isDark(o+3,n)&&t.isDark(o+4,n)&&!t.isDark(o+5,n)&&t.isDark(o+6,n)&&(r+=40);var u=0;for(n=0;e>n;n++)for(o=0;e>o;o++)t.isDark(o,n)&&u++;return r+10*(Math.abs(100*u/e/e-50)/5)}},f={glog:function(t){if(1>t)throw new Error("glog("+t+")");return f.LOG_TABLE[t]},gexp:function(t){for(;0>t;)t+=255;for(;t>=256;)t-=255;return f.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},d=0;8>d;d++)f.EXP_TABLE[d]=1<<d;for(d=8;256>d;d++)f.EXP_TABLE[d]=f.EXP_TABLE[d-4]^f.EXP_TABLE[d-5]^f.EXP_TABLE[d-6]^f.EXP_TABLE[d-8];for(d=0;255>d;d++)f.LOG_TABLE[f.EXP_TABLE[d]]=d;o.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<t.getLength();n++)e[r+n]^=f.gexp(f.glog(this.get(r))+f.glog(t.get(n)));return new o(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=f.glog(this.get(0))-f.glog(t.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<t.getLength();n++)r[n]^=f.gexp(f.glog(t.get(n))+e);return new o(r,0).mod(t)}},n.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],n.getRSBlocks=function(t,e){var r=n.getRsBlockTable(t,e);if(null==r)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var o=r.length/3,i=[],a=0;o>a;a++)for(var s=r[3*a+0],h=r[3*a+1],l=r[3*a+2],u=0;s>u;u++)i.push(new n(h,l));return i},n.getRsBlockTable=function(t,e){switch(e){case l.L:return n.RS_BLOCK_TABLE[4*(t-1)+0];case l.M:return n.RS_BLOCK_TABLE[4*(t-1)+1];case l.Q:return n.RS_BLOCK_TABLE[4*(t-1)+2];case l.H:return n.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},i.prototype={get:function(t){var e=Math.floor(t/8);return 1==(1&this.buffer[e]>>>7-t%8)},put:function(t,e){for(var r=0;e>r;r++)this.putBit(1==(1&t>>>e-r-1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var c=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],p=function(){var t=function(t,e){this._el=t,this._htOption=e};return t.prototype.draw=function(t){function e(t,e){var r=document.createElementNS("http://www.w3.org/2000/svg",t);for(var o in e)e.hasOwnProperty(o)&&r.setAttribute(o,e[o]);return r}var r=this._htOption,o=this._el,n=t.getModuleCount();Math.floor(r.width/n),Math.floor(r.height/n),this.clear();var i=e("svg",{viewBox:"0 0 "+String(n)+" "+String(n),width:"100%",height:"100%",fill:r.colorLight});i.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),o.appendChild(i),i.appendChild(e("rect",{fill:r.colorDark,width:"1",height:"1",id:"template"}));for(var a=0;n>a;a++)for(var s=0;n>s;s++)if(t.isDark(a,s)){var h=e("use",{x:String(a),y:String(s)});h.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),i.appendChild(h)}},t.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},t}(),m="svg"===document.documentElement.tagName.toLowerCase()?p:"undefined"!=typeof CanvasRenderingContext2D?function(){function t(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}if(this._android&&this._android<=2.1){var e=1/window.devicePixelRatio,r=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(t,o,n,i,a,s,h,l){if("nodeName"in t&&/img/i.test(t.nodeName))for(var u=arguments.length-1;u>=1;u--)arguments[u]=arguments[u]*e;else void 0===l&&(arguments[1]*=e,arguments[2]*=e,arguments[3]*=e,arguments[4]*=e);r.apply(this,arguments)}}var o=function(t,e){this._bIsPainted=!1,this._android=a(),this._htOption=e,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=e.width,this._elCanvas.height=e.height,t.appendChild(this._elCanvas),this._el=t,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return o.prototype.draw=function(t){var e=this._elImage,r=this._oContext,o=this._htOption,n=t.getModuleCount(),i=o.width/n,a=o.height/n,s=Math.round(i),h=Math.round(a);e.style.display="none",this.clear();for(var l=0;n>l;l++)for(var u=0;n>u;u++){var g=t.isDark(l,u),f=u*i,d=l*a;r.strokeStyle=g?o.colorDark:o.colorLight,r.lineWidth=1,r.fillStyle=g?o.colorDark:o.colorLight,r.fillRect(f,d,i,a),r.strokeRect(Math.floor(f)+.5,Math.floor(d)+.5,s,h),r.strokeRect(Math.ceil(f)-.5,Math.ceil(d)-.5,s,h)}this._bIsPainted=!0},o.prototype.makeImage=function(){this._bIsPainted&&function(t,e){var r=this;if(r._fFail=e,r._fSuccess=t,null===r._bSupportDataURI){var o=document.createElement("img"),n=function(){r._bSupportDataURI=!1,r._fFail&&_fFail.call(r)};return o.onabort=n,o.onerror=n,o.onload=function(){r._bSupportDataURI=!0,r._fSuccess&&r._fSuccess.call(r)},void(o.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==")}!0===r._bSupportDataURI&&r._fSuccess?r._fSuccess.call(r):!1===r._bSupportDataURI&&r._fFail&&r._fFail.call(r)}.call(this,t)},o.prototype.isPainted=function(){return this._bIsPainted},o.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},o.prototype.round=function(t){return t?Math.floor(1e3*t)/1e3:t},o}():function(){var t=function(t,e){this._el=t,this._htOption=e};return t.prototype.draw=function(t){for(var e=this._htOption,r=this._el,o=t.getModuleCount(),n=Math.floor(e.width/o),i=Math.floor(e.height/o),a=['<table style="border:0;border-collapse:collapse;">'],s=0;o>s;s++){a.push("<tr>");for(var h=0;o>h;h++)a.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+n+"px;height:"+i+"px;background-color:"+(t.isDark(s,h)?e.colorDark:e.colorLight)+';"></td>');a.push("</tr>")}a.push("</table>"),r.innerHTML=a.join("");var l=r.childNodes[0],u=(e.width-l.offsetWidth)/2,g=(e.height-l.offsetHeight)/2;u>0&&g>0&&(l.style.margin=g+"px "+u+"px")},t.prototype.clear=function(){this._el.innerHTML=""},t}();(t=function(t,e){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:l.H},"string"==typeof e&&(e={text:e}),e)for(var r in e)this._htOption[r]=e[r];"string"==typeof t&&(t=document.getElementById(t)),this._android=a(),this._el=t,this._oQRCode=null,this._oDrawing=new m(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)}).prototype.makeCode=function(t){this._oQRCode=new r(s(t,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(t),this._oQRCode.make(),this._el.title=t,this._oDrawing.draw(this._oQRCode),this.makeImage()},t.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},t.prototype.clear=function(){this._oDrawing.clear()},t.CorrectLevel=l}();const e=()=>document.querySelector("#reviewAppQrCode img"),r=()=>document.querySelector(".branch-action");!e()&&r()&&((()=>{const t=document.createElement("div");t.id="reviewAppQrCode",t.style.cssText="display: flex; align-items: center; justify-content: center; margin: 1rem;",r().appendChild(t)})(),(()=>{const{href:e}=document.querySelector(".merge-status-item a.btn");new t(document.getElementById("reviewAppQrCode"),e)})(),e().style.cssText="border: 1rem solid white;")}());

Toggle Elements Outline

javascript:(function(){window.isElementsOutlineVisible=!Boolean(window.isElementsOutlineVisible),window.isElementsOutlineVisible?document.head.insertAdjacentHTML("beforeend",'<style id="elementsOutlines">* {outline: 1px dashed red !important}</style>'):document.getElementById("elementsOutlines")?.remove();})();

Clear Cookies

javascript:(function(){document.cookie.split(";").forEach(function(c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/"); }); })();

Clear Local Storage

javascript:(function(){localStorage.clear()}());

Clear Session Storage

javascript:(function(){sessionStorage.clear()}());

Clear All Cache

javascript:(function(){(()=>localStorage.clear())(),(()=>sessionStorage.clear())(),document.cookie.split(";").forEach(e=>{document.cookie=e.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}),window.location.reload(true);}());

Toggle Ruller

javascript:(function(){var Event=function(){"use strict"; this.attach=function(evtName, element, listener, capture){ var evt="", useCapture=capture === undefined ? true : capture, handler=null; if (window.addEventListener === undefined){ evt="on" + evtName; handler=function(evt, listener){ element.attachEvent(evt, listener); return listener; }; } else{ evt=evtName; handler=function(evt, listener, useCapture){ element.addEventListener(evt, listener, useCapture); return listener; }; } return handler.apply(element, [ evt, function(ev){ var e=ev || event, src=e.srcElement || e.target; listener(e, src); }, useCapture, ]); }; this.detach=function(evtName, element, listener, capture){ var evt="", useCapture=capture === undefined ? true : capture; if (window.removeEventListener === undefined){ evt="on" + evtName; element.detachEvent(evt, listener); } else{ evt=evtName; element.removeEventListener(evt, listener, useCapture); } }; this.stop=function(evt){ evt.cancelBubble=true; if (evt.stopPropagation){ evt.stopPropagation(); } }; this.prevent=function(evt){ if (evt.preventDefault){ evt.preventDefault(); } else{ evt.returnValue=false; } }; }; var Dragdrop=function(evt){"use strict"; var elem=null, started=0, self=this, moveHandler=null, doc=document.documentElement, body=document.body, gWidth=document.body.scrollWidth > document.documentElement.clientWidth ? document.body.scrollWidth : document.documentElement.clientWidth, gHeight=Math.max(body.scrollHeight, body.offsetHeight, doc.clientHeight, doc.scrollHeight, doc.offsetHeight), move=function(e){ var xDiff=e.clientX - elem.posX, yDiff=e.clientY - elem.posY, x=xDiff - (xDiff % elem.snap) + "px", y=yDiff - (yDiff % elem.snap) + "px"; if (started === 1){ switch (elem.mode){ case 0: elem.style.top=y; elem.style.left=x; break; case 1: elem.style.left=x; break; case 2: elem.style.top=y; break; } if (elem.mode !== 2){ if (xDiff <= elem.minX){ elem.style.left=elem.minX + "px"; } if (elem.offsetLeft + elem.offsetWidth >= elem.maxX){ elem.style.left=elem.maxX - elem.offsetWidth + "px"; } } if (elem.mode !== 1){ if (yDiff <= elem.minY){ elem.style.top=elem.minY + "px"; } if (elem.offsetTop + elem.offsetHeight >= elem.maxY){ elem.style.top=elem.maxY - elem.offsetHeight + "px"; } } elem.onMove(elem); } }, start=function(e, src){ if (src.className.indexOf("draggable") !== -1){ evt.prevent(e); moveHandler=evt.attach("mousemove", document, move, true); started=1; elem=src; elem.posX=e.clientX - elem.offsetLeft; elem.posY=e.clientY - elem.offsetTop; if (elem.mode === undefined){ self.set(elem); } elem.onStart(elem); if (elem.setCapture){ elem.setCapture(); } } }, stop=function(){ if (started === 1){ started=0; elem.onStop(elem); evt.detach("mousemove", document, moveHandler); if (elem.releaseCapture){ elem.releaseCapture(); } } }; evt.attach("mousedown", document, start, false); evt.attach("mouseup", document, stop, false); this.start=start; this.set=function(element, elemOptions){ var options=elemOptions || {}; elem=typeof element === "string" ? document.getElementById(element) : element; elem.mode=options.mode || 0; elem.minX=options.minX || 0; elem.maxX=options.maxX || gWidth; elem.minY=options.minY || 0; elem.maxY=options.maxY || gHeight; elem.snap=options.snap || 1; elem.onStart=options.onstart || function() {}; elem.onMove=options.onmove || function() {}; elem.onStop=options.onstop || function() {}; elem.style.left=elem.offsetLeft + "px"; elem.style.top=elem.offsetTop + "px"; elem.unselectable="on"; }; }; var RulersGuides=function(evt, dragdrop){"use strict"; var doc=document.documentElement, body=document.body, wrapper=null, lockHandler=null, locked=1, hRuler=null, vRuler=null, menu=null, dialogs=[], snapDialog=null, openGridDialog=null, xSnap=0, ySnap=0, mode=2, guides={}, guidesCnt=0, gUid="", rulerStatus=1, guideStatus=1, hBound=0, vBound=0, gridList=null, gridListLen=0, menuBtn=null, gInfoBlockWrapper=null, detailsStatus=0, domElements=[], domDimensions=[], resizeTimer=null, snapDom=0, cssText= "html,body{margin:0;padding:0}.rg-overlay{position:absolute;top:0;left:0;overflow:hidden}.guide{position:absolute;top:0;left:0;z-index:99991;font-size:0}.guide.v{width:1px;height:7000px;border-right:solid 1px #00f;cursor:col-resize}.guide.h{width:3000px;height:1px;border-bottom:solid 1px #00f;cursor:row-resize}.info{width:50px;height:25px;line-height:25px;text-align:center;position:relative;font-size:13px;background-color:#eee;border:solid 1px #ccc;color:#000}.guide.v .info{left:2px}.guide.h .info{top:2px}.unselectable{-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ruler{background-color:#ccc;position:absolute;top:0;left:0;z-index:99990}.ruler .label{font:12px Arial;color:#000}.ruler,.ruler span{font-size:0}.ruler.h{width:3000px;position:fixed;left:-1px;padding-top:14px;border-bottom:solid 1px #000}.ruler.v{height:7000px;top:-1px;padding-left:16px;width:45px;border-right:solid 1px #000}.ruler.h span{border-left:solid 1px #999;height:9px;width:1px;vertical-align:bottom;display:inline-block;*display:inline;zoom:1}.ruler.v span{display:block;margin-left:auto;margin-right:0;border-top:solid 1px #999;width:9px;height:1px}.ruler.v span.major{border-top:solid 1px #000;width:13px}.ruler.v span.milestone{position:relative;border-top:solid 1px #000;width:17px}.ruler.v span.label{border:0;font-size:9px;position:absolute;text-align:center;width:9px}.ruler.h span.major{border-left:solid 1px #000;height:13px}.ruler.h span.milestone{position:relative;border-left:solid 1px #000;height:17px}.ruler.h span.label{border:0;font-size:9px;position:absolute;text-align:center;top:-14px;width:9px}.ruler.h .l10{left:-5px}.ruler.h .l100{left:-7px}.ruler.h .l1000{left:-10px}.ruler.v .l10,.ruler.v .l100,.ruler.v .l1000{top:-7px}.ruler.v .l10{left:-12px}.ruler.v .l100{left:-17px}.ruler.v .l1000{left:-23px}.menu-btn{position:fixed;left:3px;top:2px;line-height:9px;z-index:99998;width:20px;height:20px;background-color:red;opacity:.5;font-size:20px;text-align:left;color:#fff;font-weight:700;cursor:pointer;border-radius:2px}.rg-menu{position:fixed;top:22px;left:3px;padding:0;margin:0;list-style:0;display:none;font:13px Arial;z-index:99999;box-shadow:2px 2px 10px #ccc}.rg-menu li{text-align:left;border-bottom:solid 1px #999;padding:0}.rg-menu a{background-color:#777;display:block;padding:5px;text-decoration:none;color:#fff;line-height:18px}.rg-menu a:hover,.rg-menu a.selected{color:#fff;background-color:#3b94ec}.rg-menu a.disabled{color:#ccc}.rg-menu .desc{display:inline-block;width:170px}.dialog{position:fixed;background-color:#777;z-index:99999;color:#fff;font-size:13px;display:none;box-shadow:2px 2px 10px #ccc}.dialog button{border:0;color:#333;cursor:pointer;background-color:#eaeaea;background-image:linear-gradient(#fafafa,#eaeaea);background-repeat:repeat-x;border-radius:3px;text-shadow:0 1px 0 rgba(255,255,255,.9)}.dialog input,.dialog select,.dialog button{font-size:13px;margin:3px;padding:3px}.dialog .title-bar{padding:5px;background-color:#aaa;font-weight:700}.dialog .wrapper{padding:10px}.open-dialog select,.open-dialog button{float:left;display:block}.open-dialog .ok-btn,.open-dialog .cancel-btn{margin:10px 3px}.open-dialog .ok-btn{clear:both}.snap-dialog label{font-weight:700;padding:3px}.snap-dialog .ok-btn{margin-left:18px}.snap-dialog .ok-btn,.snap-dialog .cancel-btn{margin-top:10px}.snap-dialog .rg-y-label{margin-left:10px}#rg-x-snap,#rg-y-snap{width:50px}.info-block-wrapper{position:absolute;z-index:99989}.info-block{position:absolute;text-align:left}.info-block.even{background:0 0;background-color:rgba(0,0,255,.2);-ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#330000FF, endColorstr=#330000FF);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#330000FF, endColorstr=#330000FF);zoom:1}.info-block.odd{background:0 0;background-color:rgba(255,0,0,.2);-ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#33FF0000, endColorstr=#33FF0000);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#33FF0000, endColorstr=#33FF0000);zoom:1}.info-block-txt{padding:5px;display:inline-block;vertical-align:top;background-color:#777;color:#fff;font-size:13px;*display:inline;zoom:1}", Ruler=function(type, size){ var ruler=document.createElement("div"), i=0, span=document.createElement("span"), label=null, labelTxt=null, spanFrag=document.createDocumentFragment(), cnt=Math.floor(size / 2); ruler.className="ruler " + type + " unselectable"; for (i; i < cnt; i=i + 1){ span=span.cloneNode(false); if (i % 25 === 0){ span.className="milestone"; if (i > 0){ label=span.cloneNode(false); label.className="label"; if (i < 50){label.className += " l10"; } else if (i >= 50 && i < 500){label.className += " l100"; } else if (i >= 500){label.className += " l1000"; } labelTxt=document.createTextNode(i); label.appendChild(labelTxt); span.appendChild(label); } span.className="milestone"; } else if (i % 5 === 0){ span.className="major"; } else{ span.className=""; span.removeAttribute("class"); } spanFrag.appendChild(span); } ruler.appendChild(spanFrag); return ruler; }, getWindowSize=function(){ var w=Math.max(body.scrollWidth, body.offsetWidth, doc.clientWidth, doc.scrollWidth, doc.offsetWidth), h=Math.max(body.scrollHeight, body.offsetHeight, doc.clientHeight, doc.scrollHeight, doc.offsetHeight); return [w, h]; }, getScrollPos=function(){ var t=Math.max(doc.scrollTop, body.scrollTop), l=Math.max(doc.scrollLeft, body.scrollLeft); return [t, l]; }, getScrollSize=function(){ var w=Math.max(doc.scrollWidth, body.scrollWidth), h=Math.max(doc.scrollHeight, body.scrollHeight); return [w, h]; }, closeAllDialogs=function(){ var i=0; for (i; i < dialogs.length; i=i + 1){ dialogs[i].close(); } }, removeInboundGuide=function(guide, gUid){ var scrollPos=getScrollPos(); if (rulerStatus === 1 && guideStatus === 1 && ((guide.className === "guide h draggable" && guide.offsetTop < hBound + scrollPos[0]) || (guide.className === "guide v draggable" && guide.offsetLeft < vBound + scrollPos[1]))){ wrapper.removeChild(guide); delete guides[gUid]; guidesCnt=guidesCnt - 1; } }, removeInboundGuides=function(){ var i; for (i in guides){ if (guides.hasOwnProperty(i)){ removeInboundGuide(guides[i], i); } } }, toggleGuides=function(){ var i; guideStatus=1 - guideStatus; for (i in guides){ if (guides.hasOwnProperty(i)){ guides[i].style.display=guideStatus === 1 ? "block" : "none"; } } if (guideStatus === 1){ wrapper.style.display="block"; } }, toggleRulers=function(){ rulerStatus=1 - rulerStatus; if (rulerStatus === 1){ vRuler.style.display="block"; hRuler.style.display="block"; wrapper.style.display="block"; removeInboundGuides(); } else{ vRuler.style.display="none"; hRuler.style.display="none"; } }, removeGrid=function(gridName){ if (gridList[gridName] !== undefined){ delete gridList[gridName]; window.localStorage.setItem("RulersGuides", JSON.stringify(gridList)); gridListLen=gridListLen - 1; } }, deleteGuides=function(){ var i; if (guidesCnt > 0){ for (i in guides){ if (guides.hasOwnProperty(i)){ wrapper.removeChild(guides[i]); delete guides[i]; guidesCnt=guidesCnt - 1; } } gInfoBlockWrapper.style.display="none"; } }, renderGrid=function(gridName){ if (gridList[gridName] !== undefined){ var grid=gridList[gridName], guideId=null, guideElem=null; deleteGuides(); for (guideId in grid){ if (grid.hasOwnProperty(guideId)){ guideElem=document.createElement("div"); guideElem.id=guideId; guideElem.className=grid[guideId].cssClass; guideElem.style.cssText=grid[guideId].style; wrapper.appendChild(guideElem); guides[guideId]=guideElem; guidesCnt=guidesCnt + 1; } } } }, OpenGridDialog=function(){ var dialog=null, self=this, select=null, renderSelect=function(insertOrUpdate){ var gridName, options="", i; gridListLen=0; if (window.localStorage){ gridList=JSON.parse(window.localStorage.getItem("RulersGuides")); for (i in gridList){if (gridList.hasOwnProperty(i)){ gridListLen=gridListLen + 1; } } } if (insertOrUpdate === 0){ select=document.createElement("select"); select.id="grid-list"; } if (gridListLen > 0){ for (gridName in gridList){if (gridList.hasOwnProperty(gridName)){ options += "<option>" + gridName + "</option>"; } } select.innerHTML=options; } return select; }; this.render=function(){ if (dialog === null){ dialog=document.createElement("div"); select=renderSelect(0); var text=document.createTextNode(""), titleBar=dialog.cloneNode(false), dialogWrapper=dialog.cloneNode(false), okBtn=document.createElement("button"), cancelBtn=okBtn.cloneNode(false), delBtn=okBtn.cloneNode(false), titleBarTxt=text.cloneNode(false), okBtnTxt=text.cloneNode(false), cancelBtnTxt=text.cloneNode(false), delBtnTxt=text.cloneNode(false); titleBarTxt.nodeValue="Open grid"; okBtnTxt.nodeValue="OK"; cancelBtnTxt.nodeValue="Cancel"; delBtnTxt.nodeValue="Delete"; dialog.className="dialog open-dialog"; titleBar.className="title-bar"; dialogWrapper.className="wrapper"; okBtn.className="ok-btn"; cancelBtn.className="cancel-btn"; delBtn.className="del-btn"; titleBar.appendChild(titleBarTxt); okBtn.appendChild(okBtnTxt); cancelBtn.appendChild(cancelBtnTxt); delBtn.appendChild(delBtnTxt); dialogWrapper.appendChild(select); dialogWrapper.appendChild(delBtn); dialogWrapper.appendChild(okBtn); dialogWrapper.appendChild(cancelBtn); dialog.appendChild(titleBar); dialog.appendChild(dialogWrapper); body.appendChild(dialog); evt.attach("click", delBtn, function(){ if (window.confirm("Are you sure ?")){if (select.options.length > 0){ removeGrid(select.options[select.selectedIndex].value); select.removeChild(select.options[select.selectedIndex]); } if (select.options.length === 0){ self.close(); } } }); evt.attach("click", okBtn, function(){ renderGrid(select.value); self.close(); }); evt.attach("click", cancelBtn, function(){ self.close(); }); } }; this.render(); this.open=function(){ closeAllDialogs(); renderSelect(1); if (gridListLen > 0){ dialog.style.display="block"; dialog.style.left=(doc.clientWidth - dialog.clientWidth) / 2 + "px"; dialog.style.top=(doc.clientHeight - dialog.clientHeight) / 2 + "px"; } }; this.close=function(){ dialog.style.display="none"; }; }, toggleRulersLock=function(){ if (locked === 0){ if (lockHandler !== null){ evt.detach("scroll", window, lockHandler); } } else{ lockHandler=evt.attach("scroll", window, function(){ var pos=getScrollPos(), size=getScrollSize(); hRuler.style.top=pos[0] + "px"; wrapper.style.height=size[1] + "px"; vRuler.style.left=pos[1] + "px"; wrapper.style.width=size[0] + "px"; }); } locked=1 - locked; }, saveGrid=function(){ var data={}, gridData={}, i, gridName=""; while (gridName === "" && guidesCnt > 0){ gridName=window.prompt("Save grid as"); if (gridName !== "" && gridName !== false && gridName !== null && window.localStorage){ for (i in guides){ if (guides.hasOwnProperty(i)){gridData[i] ={cssClass: guides[i].className, style: guides[i].style.cssText }; } } if (window.localStorage.getItem("RulersGuides") !== null){ data=JSON.parse(window.localStorage.getItem("RulersGuides")); } data[gridName]=gridData; window.localStorage.setItem("RulersGuides", JSON.stringify(data)); gridListLen=gridListLen + 1; } } }, showDetailedInfo=function(){ var i, j=0, hGuides=[], vGuides=[], scrollSize=getScrollSize(), infoBlockWrapper=document.createElement("div"), infoFrag=document.createDocumentFragment(), infoBlock=infoBlockWrapper.cloneNode(false), infoBlockTxt=infoBlockWrapper.cloneNode(false), infoData1=document.createTextNode(""), infoData2=infoData1.cloneNode(false), text="", br=document.createElement("br"); for (i in guides){ if (guides.hasOwnProperty(i)){ if (guides[i].type === "h"){ hGuides.push(guides[i].y); } else{ vGuides.push(guides[i].x); } } } vGuides.unshift(0); vGuides.push(scrollSize[0]); hGuides.unshift(0); hGuides.push(scrollSize[1]); vGuides=vGuides.sort(function(a, b){ return a - b; }); hGuides=hGuides.sort(function(a, b){ return a - b; }); for (i=0; i < hGuides.length - 1; i=i + 1){ j=0; for (j; j < vGuides.length - 1; j=j + 1){ infoBlock=infoBlock.cloneNode(false); infoBlockTxt=infoBlockTxt.cloneNode(false); infoData1=infoData1.cloneNode(false); infoData2=infoData2.cloneNode(false); br=br.cloneNode(); infoBlockWrapper.className="info-block-wrapper"; infoBlock.className="info-block"; infoBlockTxt.className="info-block-txt"; infoBlock.className += (i % 2 !== 0 && j % 2 !== 0) || (i % 2 === 0 && j % 2 === 0) ? " even" : " odd"; infoBlock.style.top=hGuides[i] + "px"; infoBlock.style.left=vGuides[j] + "px"; infoBlock.style.width=vGuides[j + 1] - vGuides[j] + "px"; infoBlock.style.height=hGuides[i + 1] - hGuides[i] + "px"; text=vGuides[j + 1] - vGuides[j] + " x " + (hGuides[i + 1] - hGuides[i]); infoData1.nodeValue=text; text=hGuides[i] + " : " + vGuides[j]; infoData2.nodeValue=text; infoBlockTxt.appendChild(infoData1); infoBlockTxt.appendChild(br); infoBlockTxt.appendChild(infoData2); infoBlock.appendChild(infoBlockTxt); infoBlockTxt.style.marginTop=i === 0 ? "31px" : "0"; infoBlockTxt.style.marginLeft=j === 0 ? "42px" : "0"; infoFrag.appendChild(infoBlock); } } infoBlockWrapper.appendChild(infoFrag); if (detailsStatus === 1){ wrapper.replaceChild(infoBlockWrapper, gInfoBlockWrapper); gInfoBlockWrapper=infoBlockWrapper; } else{ gInfoBlockWrapper.style.display="none"; } }, calculateDomDimensions=function(){ var x=[], y=[], dm=[], i=0, len=domElements.length, findDimensions=function(elem){ var t=0, l=0, w=elem.offsetWidth, h=elem.offsetHeight; while (elem){ l += elem.offsetLeft - elem.scrollLeft + elem.clientLeft; t += elem.offsetTop - elem.scrollTop + elem.clientTop; elem=elem.offsetParent; } return [l, t, l + w, t + h]; }, getUnique=function(arr){ var u={}, a=[], idx=0, arrLen=arr.length; for (idx; idx < arrLen; idx=idx + 1){ if (u.hasOwnProperty(arr[idx]) === false){a.push(arr[idx]); u[arr[idx]]=1; } } return a; }; for (i; i < len; i=i + 1){ dm=findDimensions(domElements[i]); x.push(dm[0]); x.push(dm[2]); y.push(dm[1]); y.push(dm[3]); } x=getUnique(x).sort(function(a, b){ return a - b; }); y=getUnique(y).sort(function(a, b){ return a - b; }); return [x, y]; }, Menu=function(){ var menuList=null, status=0, toggles={}, menuItemsList=[ {text: "Hide rulers", hotkey: "Ctrl + Alt + R", alias: "rulers" }, {text: "Hide guides", hotkey: "Ctrl + Alt + G", alias: "guides" }, {text: "Hide all", hotkey: "Ctrl + Alt + A", alias: "all" }, {text: "Unlock rulers", hotkey: "Ctrl + Alt + L", alias: "lock" }, {text: "Clear all guides", hotkey: "Ctrl + Alt + D", alias: "clear" }, {text: "Open grid", hotkey: "Ctrl + Alt + O", alias: "open" }, {text: "Save grid", hotkey: "Ctrl + Alt + G", alias: "save" }, {text: "Snap to", hotkey: "Ctrl + Alt + C", alias: "snap" }, {text: "Show detailed info", hotkey: "Ctrl + Alt + I", alias: "details" }, {text: "Snap to DOM", hotkey: "Ctrl + Alt + E", alias: "snapdom" }, ], i=0; this.render=function(){ menuBtn=document.createElement("div"); menuBtn.className="menu-btn unselectable"; menuBtn.appendChild(document.createTextNode("\u250C")); menuList=document.createElement("ul"); menuList.className="rg-menu"; var menuItems=document.createDocumentFragment(), li=document.createElement("li"), liLink=document.createElement("a"), liDesc=document.createElement("span"), liHotKey=liDesc.cloneNode(false), liDescTxt=document.createTextNode(""), liHotKeyTxt=liDescTxt.cloneNode(false); liLink.href="javascript:"; liDesc.className="desc"; liHotKey.className="hotkey"; for (i; i < menuItemsList.length; i=i + 1){ li=li.cloneNode(false); liLink=liLink.cloneNode(false); liDesc=liDesc.cloneNode(false); liHotKey=liHotKey.cloneNode(false); liDescTxt=liDescTxt.cloneNode(false); liHotKeyTxt=liHotKeyTxt.cloneNode(false); liDescTxt.nodeValue=menuItemsList[i].text; liHotKeyTxt.nodeValue=menuItemsList[i].hotkey; liDesc.appendChild(liDescTxt); liHotKey.appendChild(liHotKeyTxt); liLink.appendChild(liDesc); liLink.appendChild(liHotKey); li.appendChild(liLink); menuItems.appendChild(li); toggles[menuItemsList[i].alias] ={obj: liLink, txt: liDescTxt }; } evt.attach("mousedown", toggles.rulers.obj, function(){ toggleRulers(); }); evt.attach("mousedown", toggles.guides.obj, function(){ toggleGuides(); }); evt.attach("mousedown", toggles.all.obj, function(){ if (rulerStatus === 1 || guideStatus === 1){ rulerStatus=guideStatus=1; wrapper.style.display="none"; } else{ rulerStatus=guideStatus=0; wrapper.style.display="block"; } toggleRulers(); toggleGuides(); }); evt.attach("mousedown", toggles.lock.obj, function(){ toggleRulersLock(); }); evt.attach("mousedown", toggles.clear.obj, function(){ deleteGuides(); }); evt.attach("mousedown", toggles.open.obj, function(){ openGridDialog.open(); }); evt.attach("mousedown", toggles.save.obj, function(){ saveGrid(); }); evt.attach("mousedown", toggles.snap.obj, function(){ snapDialog.open(); }); evt.attach("mousedown", toggles.details.obj, function(){ detailsStatus=1 - detailsStatus; showDetailedInfo(); }); evt.attach("mousedown", toggles.snapdom.obj, function(){ snapDom=1 - snapDom; if (snapDom === 1){ domDimensions=calculateDomDimensions(); } }); menuList.appendChild(menuItems); body.appendChild(menuBtn); body.appendChild(menuList); evt.attach("mousedown", menuBtn, function(){ toggles.rulers.txt.nodeValue=rulerStatus === 1 ? "Hide rulers" : "Show rulers"; if (guidesCnt > 0){ toggles.guides.obj.className=""; toggles.clear.obj.className=""; toggles.save.obj.className=""; toggles.guides.txt.nodeValue=guideStatus === 1 ? "Hide guides" : "Show guides"; } else{ toggles.guides.obj.className="disabled"; toggles.clear.obj.className="disabled"; toggles.save.obj.className="disabled"; } toggles.all.txt.nodeValue=rulerStatus === 1 || guideStatus === 1 ? "Hide all" : "Show all"; toggles.lock.txt.nodeValue=locked === 0 ? "Lock rulers" : "Unlock rulers"; toggles.details.txt.nodeValue=detailsStatus === 0 ? "Show detailed info" : "Hide detailed info"; toggles.snapdom.txt.nodeValue=snapDom === 0 ? "Snap to DOM" : "Turn off snap to DOM"; toggles.open.obj.className=gridListLen > 0 ? "" : "disabled"; menuList.style.display=status === 0 ? "inline-block" : "none"; status=1 - status; }); }; this.render(); this.close=function(){ if (menuList !== null){ menuList.style.display="none"; status=0; } }; }, SnapDialog=function(){ var dialog=null, xInput=null, yInput=null, self=this; this.render=function(){ if (dialog === null){ dialog=document.createElement("div"); xInput=document.createElement("input"); yInput=xInput.cloneNode(false); var text=document.createTextNode(""), okBtn=document.createElement("button"), xLabel=document.createElement("label"), titleBar=dialog.cloneNode(false), dialogWrapper=dialog.cloneNode(false), inputWrapper=dialog.cloneNode(false), btnWrapper=dialog.cloneNode(false), resetBtn=okBtn.cloneNode(false), cancelBtn=okBtn.cloneNode(false), yLabel=xLabel.cloneNode(false), titleBarTxt=text.cloneNode(false), xLabelTxt=text.cloneNode(false), yLabelTxt=text.cloneNode(false), okBtnTxt=text.cloneNode(false), resetBtnTxt=text.cloneNode(false), cancelBtnTxt=text.cloneNode(false); titleBarTxt.nodeValue="Snap guides to"; xLabelTxt.nodeValue="X"; yLabelTxt.nodeValue="Y"; okBtnTxt.nodeValue="OK"; resetBtnTxt.nodeValue="Reset"; cancelBtnTxt.nodeValue="Cancel"; dialog.className="dialog snap-dialog"; titleBar.className="title-bar"; dialogWrapper.className="wrapper"; xLabel.className="rg-x-label"; xLabel.setAttribute("for", "rg-x-snap"); yLabel.className="rg-y-label"; yLabel.setAttribute("for", "rg-y-snap"); xInput.setAttribute("type", "number"); xInput.value="100"; xInput.id="rg-x-snap"; xInput.setAttribute("type", "number"); yInput.value="100"; yInput.id="rg-y-snap"; okBtn.className="ok-btn"; resetBtn.className="reset-btn"; cancelBtn.className="cancel-btn"; titleBar.appendChild(titleBarTxt); xLabel.appendChild(xLabelTxt); yLabel.appendChild(yLabelTxt); okBtn.appendChild(okBtnTxt); resetBtn.appendChild(resetBtnTxt); cancelBtn.appendChild(cancelBtnTxt); inputWrapper.appendChild(xLabel); inputWrapper.appendChild(xInput); inputWrapper.appendChild(yLabel); inputWrapper.appendChild(yInput); inputWrapper.appendChild(resetBtn); btnWrapper.appendChild(okBtn); btnWrapper.appendChild(cancelBtn); dialogWrapper.appendChild(inputWrapper); dialogWrapper.appendChild(btnWrapper); dialog.appendChild(titleBar); dialog.appendChild(dialogWrapper); body.appendChild(dialog); evt.attach("mousedown", okBtn, function(){ xSnap=parseInt(xInput.value, 10); ySnap=parseInt(yInput.value, 10); self.close(); }); evt.attach("mousedown", resetBtn, function(){ xSnap=0; ySnap=0; self.close(); }); evt.attach("mousedown", cancelBtn, function(){ self.close(); }); } }; this.render(); this.open=function(){ closeAllDialogs(); dialog.style.display="block"; dialog.style.left=(doc.clientWidth - dialog.clientWidth) / 2 + "px"; dialog.style.top=(doc.clientHeight - dialog.clientHeight) / 2 + "px"; }; this.close=function(){ dialog.style.display="none"; }; }, prepare=function(){ var style=document.createElement("style"), size=getWindowSize(), elements=document.getElementsByTagName("*"), len=elements.length, i=0; for (i; i < len; i=i + 1){ domElements.push(elements[i]); } style.setAttribute("type", "text/css"); if (style.styleSheet){ style.styleSheet.cssText=cssText; } else{ style.appendChild(document.createTextNode(cssText)); } body.appendChild(style); setTimeout(function(){ hRuler=new Ruler("h", 5000); vRuler=new Ruler("v", 20000); wrapper=document.createElement("div"); gInfoBlockWrapper=wrapper.cloneNode(false); wrapper.className="rg-overlay"; gInfoBlockWrapper.className="info-block-wrapper"; wrapper.style.width=size[0] + "px"; wrapper.style.height=size[1] + "px"; wrapper.appendChild(hRuler); wrapper.appendChild(vRuler); wrapper.appendChild(gInfoBlockWrapper); body.appendChild(wrapper); domDimensions=calculateDomDimensions(); menu=new Menu(); snapDialog=new SnapDialog(); openGridDialog=new OpenGridDialog(); dialogs=[snapDialog, openGridDialog]; }, 10); }; prepare(); this.status=1; this.disable=function(){ if (vRuler !== null){ deleteGuides(); vRuler.style.display="none"; hRuler.style.display="none"; wrapper.style.display="none"; menuBtn.style.display="none"; } rulerStatus=0; this.status=0; }; this.enable=function(){ if (vRuler !== null){ vRuler.style.display="block"; hRuler.style.display="block"; wrapper.style.display="block"; menuBtn.style.display="block"; } rulerStatus=1; this.status=1; }; evt.attach("mousedown", document, function(e, src){ var x=e.clientX, y=e.clientY, guide=null, guideInfo=null, guideInfoText=null, scrollPos=getScrollPos(), snap=0; if (src.className.indexOf("menu-btn") === -1){ menu.close(); } if (vBound === 0){ vBound=vRuler.offsetWidth; hBound=hRuler.offsetHeight; } if (((x > vBound && y < hBound) || (y > hBound && x < vBound)) && rulerStatus === 1){ guide=document.createElement("div"); guideInfo=guide.cloneNode(false); guideInfoText=document.createTextNode(""); gUid="guide-" + guidesCnt; guideInfo.className="info"; guideInfo.appendChild(guideInfoText); guide.appendChild(guideInfo); if (x > vBound && y < hBound){ guide.className="guide h draggable"; guide.style.top=e.clientY + scrollPos[0] + "px"; guideInfo.style.left=x + scrollPos[1] + 10 + "px"; guide.type="h"; snap=ySnap; mode=2; } else if (y > hBound && x < vBound){ guide.className="guide v draggable"; guide.style.left=x + scrollPos[1] + "px"; guideInfo.style.top=y + scrollPos[0] - 35 + "px"; guide.type="v"; snap=xSnap; mode=1; } guide.id=gUid; guide.info=guideInfo; guide.text=guideInfoText; guide.x=0; guide.y=0; guides[gUid]=guide; wrapper.appendChild(guide); dragdrop.set(guide,{ mode: mode, onstart: function(elem){ var text=elem.mode === 1 ? parseInt(elem.style.left, 10) + 2 : parseInt(elem.style.top, 10) + 2; elem.text.nodeValue=text + "px"; if (elem.over !== undefined){ evt.detach("mouseover", elem, elem.over); evt.detach("mouseout", elem, elem.out); } }, onmove: function(elem){ var text="", pos=0, dims=[], len=0, i=0; pos=elem.mode === 1 ? elem.style.left : elem.style.top; pos=parseInt(pos, 10); if (snapDom === 1){ dims=domDimensions[elem.mode - 1]; for (i, len=dims.length; i < len; i=i + 1){if (pos <= dims[i]){ pos=dims[i]; break; } } } text=pos + "px"; if (elem.mode === 1){ elem.style.left=pos - 2 + "px"; elem.x=pos; } else{ elem.style.top=pos - 2 + "px"; elem.y=pos; } elem.text.nodeValue=text; }, onstop: function(elem){ elem.over=evt.attach("mouseover", elem, function(e, src){ if (src.className === "guide v draggable"){elem.info.style.top=e.clientY + scrollPos[0] - 35 + "px"; } else if (src.className === "guide h draggable"){elem.info.style.left=e.clientX + scrollPos[1] + 10 + "px"; } elem.info.style.display="block"; }); elem.out=evt.attach("mouseout", elem, function(){ elem.info.style.display="none"; }); }, snap: snap, }); dragdrop.start(e, guide); guidesCnt=guidesCnt + 1; } }); evt.attach("mouseup", document, function(e, src){ removeInboundGuide(src, src.id); if (detailsStatus === 1){ showDetailedInfo(); } }); evt.attach("keyup", document, function(e){ if (e.ctrlKey === true && e.altKey === true){ switch (e.keyCode){ case 83: saveGrid(); break; case 82: toggleRulers(); break; case 79: openGridDialog.open(); break; case 76: toggleRulersLock(); break; case 73: detailsStatus=1 - detailsStatus; showDetailedInfo(); break; case 71: toggleGuides(); break; case 69: snapDom=1 - snapDom; if (snapDom === 1){ domDimensions=calculateDomDimensions(); } break; case 68: deleteGuides(); break; case 67: snapDialog.open(); break; case 65: if (rulerStatus === 1 || guideStatus === 1){ rulerStatus=guideStatus=1; wrapper.style.display="none"; } else{ rulerStatus=guideStatus=0; wrapper.style.display="block"; } toggleRulers(); toggleGuides(); break; } } }); evt.attach("resize", window, function(){ var size=getWindowSize(); wrapper.style.width=size[0] + "px"; wrapper.style.height=size[1] + "px"; if (resizeTimer !== null){ window.clearTimeout(resizeTimer); } if (snapDom === 1){ resizeTimer=window.setTimeout(function(){ domDimensions=calculateDomDimensions(); }, 100); } }); }; var evt=new Event(), dragdrop=new Dragdrop(evt); if (window.rg === undefined){window.rg=new RulersGuides(evt, dragdrop); window.rg.status=0; } if (window.rg.status === 1){window.rg.disable(); } else{window.rg.enable(); }})();

source: https://mark-rolich.github.io/RulersGuides.js

DOM Monster

javascript:(function(){var script=document.createElement('script');script.src='//mir.aculo.us/dom-monster/dommonster.js?'+Math.floor((+new Date)/(864e5));document.body.appendChild(script);})();

source: https://github.com/madrobby/dom-monster

Resizer

javascript:void((function(d){if(self!=top||d.getElementById('toolbar')&&d.getElementById('toolbar').getAttribute('data-resizer'))return false;d.write('<!DOCTYPE HTML><html style="opacity:0;"><head><meta charset="utf-8"/></head><body><a data-viewport="320x480" data-icon="mobile">Mobile (e.g. Apple iPhone)</a><a data-viewport="320x568" data-icon="mobile" data-version="5">Apple iPhone 5</a><a data-viewport="375×667" data-icon="mobile" data-version="7">Apple iPhone 7</a><a data-viewport="414×736" data-icon="mobile" data-version="7+">Apple iPhone 7 Plus</a><a data-viewport="600x800" data-icon="small-tablet">Small Tablet</a><a data-viewport="768x1024" data-icon="tablet">Tablet (e.g. Apple iPad 2-3rd, mini)</a><a data-viewport="1280x800" data-icon="notebook">Widescreen</a><a data-viewport="1920×1080" data-icon="tv">HDTV 1080p</a><script src="https://lab.maltewassermann.com/viewport-resizer/resizer.min.js"></script></body></html>')})(document));

source: https://lab.maltewassermann.com/viewport-resizer/

bookmarklets's People

Contributors

kml1990 avatar

Stargazers

Benjamin Aster avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.