Skip to content

Instantly share code, notes, and snippets.

@SethWilson
Created February 24, 2012 19:16
Show Gist options
  • Save SethWilson/1903078 to your computer and use it in GitHub Desktop.
Save SethWilson/1903078 to your computer and use it in GitHub Desktop.
LabelBuilder Debug info pane bookmarklet
/**
* lb_debug_info.js
*
* This little bookmarklet populates the LabelBuilder screen with a handy debug pane that shows the details of certain hidden fields
*
* MIT Licensed.
*
* Copyright 2011-2012 Seth Wilson @SethWilson
*
* ------------------------------------------------
* author: Seth Wilson
* version: 0.1
* url:
* source:
*/
function grabValues() {
$('span#productcode').html($('input#ci_0_m').val());
$('span#iconcode').html($('input#ci_0_i').val());
$('span#colourcode').html($('input#ci_0_c').val());
$('#upsellstate1').is(':checked') ? $('span#upsell1code').html("checked"): $('span#upsell1code').html("unchecked");
$('#upsellstate2').is(':checked') ? $('span#upsell2code').html("checked"): $('span#upsell2code').html("unchecked");
$('span#previewurl').html($('#preview_0').attr('src'));
}
function runthis() {
window.setInterval(grabValues, 1000);
var html = ''
html += '<div>';
html += ' <div style="margin-left: 0px; margin-bottom: 0px;" id="content">';
html += ' <p style="padding-top: 8px; padding-bottom: 5px;"><span style="font-size:12px; font-weight:bold;">Debug Info</span></p>';
html += ' </div>';
html += ' <div style="float: left; margin-bottom: 0; position: relative; width: 164px; overflow: hidden; padding: 0px; border-color: #CCCCCC; border-style: solid; border-width: 0 1px 1px;" class="wrapper-column">';
html += '<div>';
html += '<p>Product:<span id="productcode"></span></p>';
html += '<p>Icon:<span id="iconcode"></span></p>';
html += '<p>Colour: <span id="colourcode"></span></p>';
html += '<p>Url: <span id="previewurl"></span></p>';
html += '<p>Upsell1: <span id="upsell1code"></span></p>';
html += '<p>Upsell2: <span id="upsell2code"></span></p>';
html += '</div>';
html += '</div>';
$('#connect').after(html);
}
if (typeof jQuery == 'undefined') {
var jQ = document.createElement('script');
jQ.type = 'text/javascript';
jQ.onload=runthis;
jQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
document.body.appendChild(jQ);
} else {
runthis();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment