/** * @preserve Copyright Shareaholic, Inc. (www.shareaholic.com). All Rights Reserved. */ jQuery(document).ready(function() { if (jQuery('#iconator')) jQuery('#shrsb-networks').sortable({ delay: 250, cursor: 'move', scroll: true, revert: true, opacity: 0.7, placeholder: 'dropzoneNetworks', forcePlaceholderSize: true, items: 'li' }); if (jQuery('.shrsb-bookmarks')) { jQuery('#shrsb-sortables').sortable({ handle: '.box-mid-head', delay: 250, cursor: 'move', scroll: true, revert: true, opacity: 0.7 }); jQuery('#buttonPreviewsTop,#buttonPreviewsBottom').sortable({ delay: 250, cursor: 'move', scroll: true, revert: true, opacity: 0.7, placeholder: 'dropzone', forcePlaceholderSize: true, items: 'li' }); //Select all icons upon clicking jQuery('#sel-all').click(function() { jQuery('#shrsb-networks').each(function() { jQuery('#shrsb-networks input').attr('checked', 'checked'); }); }); //Deselect all icons upon clicking jQuery('#sel-none').click(function() { jQuery('#shrsb-networks').each(function() { jQuery('#shrsb-networks input').removeAttr('checked'); }); }); //Select most popular icons upon clicking jQuery('#sel-pop').click(function() { jQuery('#shrsb-networks').each(function() { jQuery('#shrsb-networks input').removeAttr('checked'); }); jQuery('#shrsb-networks').each(function() { jQuery('#shr-facebook').attr('checked', 'checked'); jQuery('#shr-twitter').attr('checked', 'checked'); jQuery('#shr-linkedin').attr('checked', 'checked'); jQuery('#shr-googlebookmarks').attr('checked', 'checked'); jQuery('#shr-delicious').attr('checked', 'checked'); jQuery('#shr-stumbleupon').attr('checked', 'checked'); jQuery('#shr-reddit').attr('checked', 'checked'); jQuery('#shr-gmail').attr('checked', 'checked'); jQuery('#shr-mail').attr('checked', 'checked'); jQuery('#shr-printfriendly').attr('checked', 'checked'); }); }); //Swap enabled/disabled between donation options onclick jQuery('#preset-amounts').parent('label').click(function() { jQuery('#custom-amounts').attr('disabled', 'disabled').css({'cursor':'none'}); jQuery('#preset-amounts').removeAttr('disabled'); }); //Swap enabled/disabled between donation options onclick jQuery('#custom-amounts').parent('label').click(function() { jQuery('#preset-amounts').attr('disabled', 'disabled').css({'cursor':'none'}); jQuery('#custom-amounts').removeAttr('disabled'); }); // Handle tiny form submission upon selecting option to hide sponsor messages jQuery('#hide-sponsors').click(function() { jQuery('#no-sponsors').submit(); }); // Create a universal click function to close status messages... jQuery('.del-x').click(function() { jQuery(this).parent('div').parent('div').fadeOut(); }); // if checkbox isn't already checked, open warning message... jQuery("#custom-mods").click(function() { if(jQuery(this).is(":not(:checked)")) { jQuery("#custom-mods-notice").css("display", "none"); } else { jQuery("#custom-mods-notice").fadeIn("fast"); jQuery("#custom-mods-notice").css("display", "table"); } }); // close custom mods warning when they click the X jQuery(".custom-mods-notice-close").click(function() { jQuery("#custom-mods-notice").fadeOut('fast'); }); // Apply "smart options" to BG image jQuery('#bgimg-yes').click(function() { if(jQuery(this).is(':checked')) { jQuery('#bgimgs').fadeIn('slow'); } else { jQuery('#bgimgs').css('display', 'none'); } }); // Apply "smart options" to Twitter jQuery('#shr-twitter').click(function() { if (jQuery(this).attr('checked')) { jQuery('#twitter-defaults').fadeIn('fast'); } else { jQuery('#twitter-defaults').fadeOut(); } }); jQuery('#shorty').change(function() { jQuery('#shortyapimdiv-bitly').fadeOut('fast'); jQuery('#shortyapimdiv-supr').fadeOut('fast'); jQuery('#shortyapimdiv-jmp').fadeOut('fast'); if(this.value=='bitly'){ jQuery('#shortyapimdiv-bitly').fadeIn('fast'); } else if(this.value=='supr'){ jQuery('#shortyapimdiv-supr').fadeIn('fast'); } else if(this.value=='jmp'){ jQuery('#shortyapimdiv-jmp').fadeIn('fast'); } }); jQuery('#shortyapichk-supr').click(function() { if (this.checked) { jQuery('#shortyapidiv-supr').fadeIn('fast'); } else { jQuery('#shortyapidiv-supr').fadeOut('fast'); } }); jQuery('#likeButtonSetTop-yes').click(function() { if (this.checked) { jQuery('.likeButtonsAvailableTop').fadeIn('fast'); } }); jQuery('#likeButtonSetTop-no').click(function() { if (this.checked) { jQuery('.likeButtonsAvailableTop').fadeOut('fast'); } }); jQuery('#likeButtonSetBottom-yes').click(function() { if (this.checked) { jQuery('.likeButtonsAvailableBottom').fadeIn('fast'); } }); jQuery('#likeButtonSetBottom-no').click(function() { if (this.checked) { jQuery('.likeButtonsAvailableBottom').fadeOut('fast'); } }); jQuery('#fbLikeButtonTop-yes').click(function() { if (this.checked) { jQuery('.likebuttonpreviewTop').fadeIn('fast'); } }); jQuery('#fbLikeButtonBottom-yes').click(function() { if (this.checked) { jQuery('.likebuttonpreviewBottom').fadeIn('fast'); } }); jQuery('#fbLikeButtonTop-no').click(function() { if (this.checked) { jQuery('.likebuttonpreviewTop').fadeOut('fast'); } }); jQuery('#fbLikeButtonBottom-no').click(function() { if (this.checked) { jQuery('.likebuttonpreviewBottom').fadeOut('fast'); } }); jQuery('#fbSendButtonBottom-yes').click(function() { if (this.checked) { jQuery('.sendbuttonpreviewBottom').fadeIn('fast'); } }); jQuery('#fbSendButtonTop-yes').click(function() { if (this.checked) { jQuery('.sendbuttonpreviewTop').fadeIn('fast'); } }); jQuery('#fbSendButtonTop-no').click(function() { if (this.checked) { jQuery('.sendbuttonpreviewTop').fadeOut('fast'); } }); jQuery('#fbSendButtonBottom-no').click(function() { if (this.checked) { jQuery('.sendbuttonpreviewBottom').fadeOut('fast'); } }); jQuery('#googlePlusOneButtonTop-yes').click(function() { if (this.checked) { jQuery('.plusonepreviewTop').fadeIn('fast'); } }); jQuery('#googlePlusOneButtonTop-no').click(function() { if (this.checked) { jQuery('.plusonepreviewTop').fadeOut('fast'); } }); jQuery('#googlePlusOneButtonBottom-yes').click(function() { if (this.checked) { jQuery('.plusonepreviewBottom').fadeIn('fast'); } }); jQuery('#googlePlusOneButtonBottom-no').click(function() { if (this.checked) { jQuery('.plusonepreviewBottom').fadeOut('fast'); } }); jQuery('#fbLikeButtonTop-yes,#googlePlusOneButtonTop-yes,#fbSendButtonTop-yes').click(function() { if (this.checked) { jQuery('.likeButtonSetOptionsTop').fadeIn('fast'); } }); jQuery('#fbLikeButtonBottom-yes,#googlePlusOneButtonBottom-yes,#fbSendButtonBottom-yes').click(function() { if (this.checked) { jQuery('.likeButtonSetOptionsBottom').fadeIn('fast'); } }); jQuery('#fbLikeButtonTop-no,#googlePlusOneButtonTop-no,#fbSendButtonTop-no').click(function() { if(jQuery('#fbLikeButtonTop-no').get(0).checked && jQuery('#googlePlusOneButtonTop-no').get(0).checked && jQuery('#fbSendButtonTop-no').get(0).checked) { jQuery('.likeButtonSetOptionsTop').fadeOut('fast'); } }); jQuery('#fbLikeButtonBottom-no,#googlePlusOneButtonBottom-no,#fbSendButtonBottom-no').click(function() { if(jQuery('#fbLikeButtonBottom-no').get(0).checked && jQuery('#googlePlusOneButtonBottom-no').get(0).checked && jQuery('#fbSendButtonBottom-no').get(0).checked) { jQuery('.likeButtonSetOptionsBottom').fadeOut('fast'); } }); jQuery('#designer_toolTips-yes').click(function() { if (this.checked) { jQuery('.designer_toolTip_prefs').fadeIn('fast'); } }); jQuery('#designer_toolTips-no').click(function() { if (this.checked) { jQuery('.designer_toolTip_prefs').fadeOut('fast'); } }); jQuery('#position-above').click(function() { if (jQuery('#info-manual').is(':visible')) { jQuery('#info-manual').fadeOut(); } }); jQuery('#position-below').click(function() { if (jQuery('#info-manual').is(':visible')) { jQuery('#info-manual').fadeOut(); } }); jQuery('#position-manual').click(function() { if (jQuery('#info-manual').is(':not(:visible)')) { jQuery('#info-manual').fadeIn('slow'); } }); jQuery('.dtags-info').click(function() { jQuery('#tag-info').fadeIn('fast'); }); jQuery('.dtags-close').click(function() { jQuery('#tag-info').fadeOut(); }); jQuery('.shebang-info').click(function() { jQuery('#info-manual').fadeIn('fast'); }); jQuery('#shrsbresetallwarn-cancel').click(function() { jQuery('#shrsbresetallwarn').fadeOut(); }); jQuery('#shrsbresetallwarn-yes').click(function() { this.checked=jQuery('#shrsbresetallwarn').fadeOut(); this.checked=jQuery('#resetalloptionsaccept').submit(); this.checked=!this.checked; }); // Load character count and tweet output demo onload var dfaultload = 0; var dfaulttitle = 8; var dfaulturl = 13; if(jQuery("#tweetconfig").val().indexOf('${title}')!=-1) { dfaultload = Math.floor(dfaultload + dfaulttitle); } if(jQuery("#tweetconfig").val().indexOf('${short_link}')!=-1) { dfaultload = Math.floor(dfaultload + dfaulturl); } var mathdoneload = Math.floor(jQuery('#tweetconfig').val().length - dfaultload); if(mathdoneload >= 50) { jQuery('#tweetcounter span').addClass('error'); } else { jQuery('#tweetcounter span').removeClass(); } jQuery('#tweetcounter span').html(mathdoneload); var endvalueload = jQuery('#tweetconfig').val(); endvalueload = endvalueload.replace('${title}', 'Some fancy post title'); endvalueload = endvalueload.replace('${short_link}', 'http://goo.gl/dbqlx'); var endtweetload = endvalueload; jQuery('#tweetoutput span').html(endtweetload); jQuery('#tweetconfig').keyup(function() { var dfaults = 0; var title = 8; var url = 13; if(jQuery("#tweetconfig").val().indexOf('${title}')!=-1) { dfaults = Math.floor(dfaults + title); } if(jQuery("#tweetconfig").val().indexOf('${short_link}')!=-1) { dfaults = Math.floor(dfaults + url); } var mathdone = Math.floor(jQuery(this).val().length - dfaults); if(mathdone >= 50) { jQuery('#tweetcounter span').addClass('error'); alert("You need to leave room for the short URL and/or post title..."); return false; } else { jQuery('#tweetcounter span').removeClass(); } jQuery('#tweetcounter span').html(mathdone); var endvalue = jQuery(this).val(); endvalue = endvalue.replace('${title}', 'Some fancy post title'); endvalue = endvalue.replace('${short_link}', 'http://goo.gl/dbqlx'); var endtweet = endvalue; jQuery('#tweetoutput span').html(endtweet); }); // Check if like button is included and show the position prefs //var likeBtnChecked = jQuery('#fbLikeButton-yes').get(0).checked || jQuery('#googlePlusOneButton-yes').get(0).checked || jQuery('#fbSendButton-yes').get(0).checked; if (jQuery('#likeButtonSetTop-yes').get(0).checked) { jQuery('.likeButtonsAvailableTop').fadeIn('fast'); } if (jQuery('#likeButtonSetBottom-yes').get(0).checked) { jQuery('.likeButtonsAvailableBottom').fadeIn('fast'); } if(jQuery('#fbLikeButtonTop-yes').get(0).checked || jQuery('#googlePlusOneButtonTop-yes').get(0).checked || jQuery('#fbSendButtonTop-yes').get(0).checked) { jQuery('.likeButtonSetOptionsTop').fadeIn('fast'); } if(jQuery('#fbLikeButtonBottom-yes').get(0).checked || jQuery('#googlePlusOneButtonBottom-yes').get(0).checked || jQuery('#fbSendButtonBottom-yes').get(0).checked) { jQuery('.likeButtonSetOptionsBottom').fadeIn('fast'); } if(jQuery('#fbLikeButtonTop-yes').get(0).checked) { jQuery('.likebuttonpreviewTop').fadeIn('fast'); } if(jQuery('#fbLikeButtonBottom-yes').get(0).checked) { jQuery('.likebuttonpreviewBottom').fadeIn('fast'); } if(jQuery('#fbSendButtonTop-yes').get(0).checked) { jQuery('.sendbuttonpreviewTop').fadeIn('fast'); } if(jQuery('#fbSendButtonBottom-yes').get(0).checked) { jQuery('.sendbuttonpreviewBottom').fadeIn('fast'); } if(jQuery('#googlePlusOneButtonTop-yes').get(0).checked) { jQuery('.plusonepreviewTop').fadeIn('fast'); } if(jQuery('#googlePlusOneButtonBottom-yes').get(0).checked) { jQuery('.plusonepreviewBottom').fadeIn('fast'); } // Check if designer tooltips are included and show the color prefs var designerToolTipsChecked = jQuery('#designer_toolTips-yes').get(0).checked; if (designerToolTipsChecked) { jQuery('.designer_toolTip_prefs').fadeIn('fast'); } jQuery('#tip_bg_color_picker_holder').ColorPicker({ flat: true, color: jQuery("#tip_bg_color").val(), onChange : function(hsb, hex, rgb, el) { jQuery("#tip_bg_color").val('#' + hex); jQuery('#tip_bg_color_picker div').css('backgroundColor', '#' + hex); }, onSubmit: function(hsb, hex, rgb, el) { jQuery("#tip_bg_color").val('#' + hex); jQuery('#tip_bg_color_picker div').css('backgroundColor', '#' + hex); jQuery('#tip_bg_color_picker_holder').toggle(); } }); // The below lines are to prevent a nasty input form control not focussable error in chrome/safari jQuery('#tip_bg_color_picker_holder').find('input').each(function(index) { jQuery(this).attr("maxlength","50") ; }); jQuery('#tip_bg_color_picker div').bind('click', function() { jQuery('#tip_bg_color_picker_holder').toggle(); jQuery('#tip_bg_color_picker_holder').ColorPickerSetColor(jQuery("#tip_bg_color").val()); // Attach click handler to the body to hide the color picker (if visible) for clicks outside the color picker jQuery('body').trigger('click'); if(jQuery('#tip_bg_color_picker_holder').is(':visible')) { jQuery('body').bind("click",function () { jQuery('#tip_bg_color_picker_holder').hide(); jQuery('body').unbind("click"); }); } return false; }); jQuery('#tip_bg_color_reset').bind('click', function() { jQuery("#tip_bg_color").val('#000000'); jQuery('#tip_bg_color_picker div').css('backgroundColor', '#000000'); }); // Prevent the body click handler from firing if the click is inside the color picker jQuery('#tip_bg_color_picker_holder').click(function() { return false;}); jQuery('#tip_text_color_picker_holder').ColorPicker({ flat: true, color: jQuery("#tip_text_color").val(), onChange : function(hsb, hex, rgb, el) { jQuery("#tip_text_color").val('#' + hex); jQuery('#tip_text_color_picker div').css('backgroundColor', '#' + hex); }, onSubmit: function(hsb, hex, rgb, el) { jQuery("#tip_text_color").val('#' + hex); jQuery('#tip_text_color_picker div').css('backgroundColor', '#' + hex); jQuery('#tip_text_color_picker_holder').toggle(); } }); // The below lines are to prevent a nasty input form control not focussable error in chrome/safari jQuery('#tip_text_color_picker_holder').find('input').each(function(index) { jQuery(this).attr("maxlength","50") ; }); jQuery('#tip_text_color_picker div').bind('click', function() { jQuery('#tip_text_color_picker_holder').toggle(); jQuery('#tip_text_color_picker_holder').ColorPickerSetColor(jQuery("#tip_text_color").val()); // Attach click handler to the body to hide the color picker (if visible) for clicks outside the color picker jQuery('body').trigger('click'); if(jQuery('#tip_text_color_picker_holder').is(':visible')) { jQuery('body').bind("click",function () { jQuery('#tip_text_color_picker_holder').hide(); jQuery('body').unbind("click"); }); } return false; }); // Prevent the body click handler from firing if the click is inside the color picker jQuery('#tip_text_color_picker_holder').click(function() { return false;}); jQuery('#tip_text_color_reset').bind('click', function() { jQuery("#tip_text_color").val('#ffffff'); jQuery('#tip_text_color_picker div').css('backgroundColor', '#ffffff'); }); }}); /** * * Color picker * Author: Stefan Petre www.eyecon.ro * * Dual licensed under the MIT and GPL licenses * */ (function($){var ColorPicker=function(){var ids={},inAction,charMin=65,visible,tpl='