$(document).ready( function () { if(CustomerID == undefined) { $("#cat-tree").Tree(); } $('#nwdg_headline_color').minicolors({ defaultValue: "#2d57a1" }); $('#nwdg_brief_color').minicolors({ defaultValue: "#666666" }); $('.color_field').minicolors({ defaultValue: "#333333" }); //intialize widget refresh_widget_js(); $('.nwdg_update_widget').click(function(){ refresh_widget_js(); }); //click on textarea and auto-select text $('#nwdg_widget_code').on('focus', function(){ var $this = $(this); $this.select(); window.setTimeout(function() { $this.select(); }, 1); // Work around WebKit's little problem function mouseUpHandler() { // Prevent further mouseup intervention $this.off("mouseup", mouseUpHandler); return false; } $this.mouseup(mouseUpHandler); }); //click on legacy code textarea and auto-select text $('#nwdg_legacy_code').on('focus', function(){ var $this = $(this); $this.select(); window.setTimeout(function() { $this.select(); } , 1); // Work around WebKit's little problem function mouseUpHandler() { // Prevent further mouseup intervention $this.off("mouseup", mouseUpHandler); return false; } $this.mouseup(mouseUpHandler); }); }); function refresh_widget_js() { var widget_categories = ''; var widget_title = '24-7PressRelease.com Recent News (Updated)' var widget_width = 'auto' var widget_headlinebold = 0; var widget_headlinesonly = 0; var showimages = 0; var headline_separator = 'none'; var typeface = 'Arial'; var fontsize = '10'; var headlinecolor = '2d57a1'; var briefcolor = '666666'; var textcolor = '333333'; var bgcolor = 'ffffff'; var numstories = '5'; var urldest = '247pr'; // URL destination update urldest = $('#nwdg_link_dest').val(); if(CustomerID == undefined) { // parse categories $.each($("#cat-tree input[name='categorynum[]']:checked"), function() { widget_categories += ($(this).val()+','); }); } // headline separator headline_separator = $("#nwdg_headline_separator input[name=nwdg_headline_sep]:checked").val(); //number of stories update numstories = $('#nwdg_number_stories').val(); //update widget title widget_title = $('#widget_title').val(); //update widget width widget_width = $('#nwdg_width').val(); //update headline bold if($('#nwdg_bold_headline').is(':checked')) { widget_headlinebold = 1; } //typeface updatae typeface = $('#nwdg_typeface').val(); //fontsize updatae fontsize = $('#nwdg_fontsize').val(); //headlines only widget_headlinesonly = $('#nwdg_headline_options').val(); //headline color headlinecolor = $('#nwdg_headline_color').val().replace('#',''); //brief color briefcolor = $('#nwdg_brief_color').val().replace('#',''); //text color textcolor = $('#nwdg_text_color').val().replace('#',''); // show images update if($('#nwdg_include_images').is(':checked')) { showimages = 1; } if(CustomerID == undefined) { if(widget_categories == '') widget_text = ''; else widget_text = '&categories='+widget_categories; } else widget_text = '&customerid='+CustomerID; widget_params = 'widgettitle='+widget_title+widget_text+'&showRelease=1&width='+widget_width+'&headlinebold='+widget_headlinebold+'&headlinesonly='+widget_headlinesonly+'&headlinecolor='+headlinecolor+'&briefcolor='+briefcolor+'&textcolor='+textcolor+'&typeface='+typeface+'&fontsize='+fontsize+'&width='+widget_width+'&headlinesepstyle='+headline_separator+'&showimages='+showimages+'&numstories='+numstories+'&bgcolor='+bgcolor+'&urldest='+urldest; $('#nwdg_widget_code').val(' '); //update widget preview pane $('#nwdg_preview_iframe').attr('src','/news_widget_prev.php?'+widget_params); function htmlEncode(value){ //create a in-memory div, set it's inner text(which jQuery automatically encodes) //then grab the encoded contents back out. The div never exists on the page. return $('
').text(value).html(); } function htmlDecode(value){ return $('
').html(value).text(); } }