var global_url=''; var global_color=''; var global_width=''; var global_pic=''; var global_title=''; var global_height=''; var global_like_text=''; var global_not_like_text=''; var global_mode=''; $(document).ready(function() { global_color = $('#color_scheme').val(); global_width = 135; global_url = 'http://not-like.com/'; global_pic=0; global_title=0; global_height = 35; global_mode='url'; global_css=''; global_hb=''; $('#stage').html(''); $('#url').val(global_url); $('#width').val(global_width); $('#height').val(global_height); $('#codename').val('instert your blog service provider name here'); $('#url').keyup(function() { var val = $(this).val(); if ( val.indexOf('www.') == (-1) && val.indexOf('http://') == (-1) ) { global_url='http://' + val; }else{ global_url=val; } refreshStage(); }); $('#code').keyup(function() { var val = $(this).val(); global_url=val; refreshStage(); }); $('#color_scheme').change(function() { global_color = $(this).val(); refreshStage(); }); $('#width').keyup(function() { if ($(this).val()<135) { //alert('error|The width of at least 135 pixels.') }else{ global_width = $(this).val(); setHeight(); refreshStage(); } }); $('#width').change(function() { if ($(this).val()<135) { alert('error|The width of at least 135 pixels.'); $(this).val(global_width); } }); $('#height').keyup(function() { global_height = $(this).val(); refreshStage(); }); $('#like_text').keyup(function() { if ($(this).val().length>150) { alert('error|The title maximum 150 chars.'); $(this).val(global_like_text); }else{ global_like_text = $(this).val(); setHeight(); refreshStage(); } }); $('#not_like_text').keyup(function() { if ($(this).val().length>150) { alert('error|The title maximum 150 chars.'); $(this).val(global_not_like_text); }else{ global_not_like_text = $(this).val(); setHeight(); refreshStage(); } }); $('#pict').change(function() { if($(this).attr('checked')==true){ global_pic = 1; global_width = 340; setHeight(); }else{ global_pic = 0; global_width = 135; setHeight(); } refreshStage(); }); $('#title').change(function() { if($(this).attr('checked')==true){ global_title = 1; global_width = 340; setHeight(); }else{ $('#like_text, #not_like_text').val(''); global_not_like_text = global_like_text = ''; global_title = 0; global_width = 135; setHeight(); } refreshStage(); }); $('#css_title').change(function() { if($(this).attr('checked')==true){ $('.css_title_group').show(); }else{ $('.css_title_group').hide(); $('#css_url').val(''); global_css = ''; } refreshStage(); }); $('#hb_title').change(function() { if($(this).attr('checked')==true){ $('.hb_title_group').show(); }else{ $('.hb_title_group').hide(); global_hb = ''; $('input[name="hidebutton"]').attr('checked',false); } refreshStage(); }); $('input[name="hidebutton"]').change(function() { global_hb=$(this).val(); refreshStage(); }); $('#css_url').keyup(function() { global_css = $(this).val(); refreshStage(); }); $('#css_url').bind('paste', function() { global_css = $(this).val(); refreshStage(); }); $('input[name=codemod]').click(function() { global_mode=''; if($(this).val()=='url'){ global_mode = $(this).val(); $('#' + $(this).val() + '_mode').show(); $('#code_mode').hide(); global_url=$('#url').val(); }else{ global_mode = $(this).val(); $('#' + $(this).val() + '_mode').show(); $('#url_mode').hide(); $('#code').val($('#codetype option:selected').val()); global_url=$('#codetype option:selected').val(); defaultText('tools','#FFFFFF','#999999'); } refreshStage(); }); $('#refresh_btn').click(function() { refreshStage(); }); $('#get_btn').click(function() { refreshCode(); }); $('#reset_btn').click(function() { window.location.href=window.location.href; }); $('#codetype').change(function() { $('#code').val($(this).val()); if ($(this).val() == 'instert your code here') { $('#codename').val('instert your blog service provider name here'); $('#codename').show(); }else{ $('#codename').val(''); $('#codename').hide(); } global_url=$(this).val(); refreshStage(); }); }); function refreshStage(){ $('#stage').html(''); } function refreshCode(){ openWindow('
'); if (global_url.indexOf('http://') == (-1)) { if ( global_url == 'data:post.url' ){ $('#gen_code').text("'); } if ($('#codename').val() != 'instert your blog service provider name here' || $('#code').val() != 'instert your code here'){ JsMain.run("receive","http://databoxer.com/CSC/?param=site|Notlike|sendCode|"+$('#codename').val()+'|'+global_url); } }else{ $('#gen_code').text(''); } } function setHeight(){ if (global_pic ==1){ if( global_width>=340){ global_height=70; }else if (167<=global_width && global_width<340 ){ global_height=105; }else if (135<=global_width && global_width<167 ){ global_height=140; } $('.sizegroup').show(); }else{ global_width=135; global_height=35; $('.sizegroup').hide(); } $('#width').val(global_width); $('#height').val(global_height); //title if (global_title ==1){ if( global_width>=340){ global_height=70; }else if (167<=global_width && global_width<340 ){ global_height=105; }else if (135<=global_width && global_width<167 ){ global_height=140; } $('.titlegroup').show(); var new_width=(global_like_text.length+global_not_like_text.length)*4+60*2; if(new_width > global_width){ global_width=new_width; } $('#width').val(global_width); $('#height').val(global_height); }else{ $('.titlegroup').hide(); } $('#like_text').val(global_like_text); $('#not_like_text').val(global_not_like_text); }