Created
October 19, 2011 20:22
-
-
Save ddunlop/1299550 to your computer and use it in GitHub Desktop.
Stats js call decoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { var keys = { fps: 'Cookie', op: 'Operation', sh: 'Screen Height', sw: 'Screen Width', ch: 'Channel', se: 'Section', ti: 'Tickers', pt: 'Page Type', i: 'Content ID', su: 'URL', re: 'referrer', au: 'Author', at: 'Author Type', pa: 'Partner' }; var el = document.getElementById('pzndiv'); if(el) { el = el.firstChild; var url = el.src; var parts = url.split("?", 2); var url = parts[0], query = parts[1], html = ""; html += "<div>location: "+url +"</div>"; html += "<div><h3 style='color:white;margin:1em 0;'>Params</h3><ul>"; var qparams = query.split('&'), params = {}; for(var i = 0; i< qparams.length; i++) { var param = qparams[i].split('=', 2); var key = param[0]; if(keys.hasOwnProperty(key)) { key = keys[key]; } html += "<li><em>" + key + "</em> - " + decodeURI(param[1]); } html += "</ul>"; show(html); } else { show("Can't find a stats call on this page"); } function show(html) { var style = { cursor: 'pointer', textAlign: 'left', listStyle: 'none', font: 'bold 15px "Lucida Grande"', backgroundColor: 'rgba(0, 0, 0, 0.8)', color: '#fff', BorderRadius: '5px', MozBorderRadius: '5px', WebkitBorderRadius: '5px', borderTop: 'solid 1px rgba(255, 255, 255, 0.4)', borderLeft: 'solid 1px rgba(0, 0, 0, 0.8)', borderRight: 'solid 1px rgba(0, 0, 0, 0.8)', borderBottom: 'solid 1px #000', textShadow: '0 1px 0 #000', BoxShadow: '0 -1px 0 #000', MozBoxShadow: '0 -1px 0 #000', WebkitBoxShadow: '0 -1px 0 #000', position: 'fixed', padding: '10px', margin: '0', right: '10px', 'top': '10px', zIndex: 1000 }; var el = document.getElementById('_fastBookmarklet'); if(el) { el.parentNode.removeChild(el); } var props = { id: '_fastBookmarklet', innerHTML: html, onclick: function() { this.parentNode.removeChild(this); } }; var el = document.createElement('div'); for(var key in props) { el[key] = props[key]; } for(var key in style) { el.style[key] = style[key]; } document.body.appendChild(el); } })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment