$(document).ready(function() { $(".e-hideme").hide(); $(".e-expandit").show(); $(".e-expandit").click(function () { var id = $(this).attr("href"); $(id).toggle("slow"); }); // Date $(function() { $("input.e-date").each(function() { $(this).datepicker({ dateFormat: $(this).attr("data-date-format"), ampm: $(this).attr("data-date-ampm") }); }); $("input.e-datetime").each(function() { $(this).datetimepicker({ dateFormat: $(this).attr("data-date-format"), timeFormat: $(this).attr("data-time-format"), ampm: $(this).attr("data-date-ampm") }); }); // Inline versions $("div.e-date").each(function() { var id = $(this).attr("id"); var newid = id.replace("inline-", ""); $(this).datepicker({ dateFormat: $(this).attr("data-date-format"), ampm: $(this).attr("data-date-ampm"), defaultDate: $("#"+newid).val(), onSelect: function(dateText, inst) { $("#"+newid).val(dateText); } }); }); $("div.e-datetime").each(function() { var id = $(this).attr("id"); var newid = id.replace("inline-", ""); $(this).datetimepicker({ dateFormat: $(this).attr("data-date-format"), ampm: $(this).attr("data-date-ampm"), showButtonPanel: false, onSelect: function(dateText, inst) { $("#"+newid).val(dateText); } }); $(this).datetimepicker('setDate', $("#"+newid).val()); }); }); // Tabs $(function() { $( "#tab-container" ).tabs(); }); // Tabs $(function() { $( ".e-tabs" ).tabs(); }); /* $("a.e-bb").click(function(){ var add = $(this).attr('data-bbcode'); var func = $(this).attr('data-function'); var diz = $(this).attr('title'); id = $(this).attr('href'); var tmp = id.replace('#',''); //alert(tmp); if(func == 'insert') { addtext(add,true); return false; } if(func == 'input') { addinput(add,diz); return false; } if(func == 'show') { $('#'+add).show('slow'); // addinput(add,diz); return false; } if(func == 'add') { addtext(add); return false; } return false; }); $("select.e-bb").change(function(){ var add = $(this).val(); addtext(add); $(this).val(''); return false; }); $(".e-bb").mouseover(function(){ var id = $(this).attr('id'); var diz = $(this).attr('title'); // alert(id); var tmp = id.split('--'); // alert('#'+tmp[0]); $('#'+tmp[0]).val(diz); return false; }); $(".e-bb").mouseout(function(){ var id = $(this).attr('id'); var tmp = id.split('--') $('#'+tmp[0]).val(''); return false; }); */ // $(".e-multiselect").chosen(); // Password $(function() { $("#password1").pwdMeter({ minLength: 6, displayGeneratePassword: true, generatePassText: "Generate", randomPassLength: 12 }); }); // Character Counter // $("textarea").before("
"); $("textarea").keyup(function(){ // var max=$(this).attr("maxlength"); var max = 100; var el = "#" + $(this).attr("name") + "-remainingCharacters"; var valLen=$(this).val().length; $(el).text( valLen + " characters") }); // Dialog $("a.e-dialog").colorbox({ iframe:true, width:"60%", height:"70%", speed:100 }); $(".e-dialog-close").click(function () { parent.$.colorbox.close() }); // Modal Box - uses inline hidden content $(".e-modal").click(function () { var id = $(this).attr("href"); $(id).dialog({ minWidth: 800, maxHeight: 700, modal: true }); }); $(".e-shake" ).effect("shake","",100); $('.e-rate').each(function() { var path = $(this).attr("data-path"); var script = $(this).attr("data-url"); var score = $(this).attr("data-score"); var readonly = parseInt($(this).attr("data-readonly")); var tmp = $(this).attr('id'); var hint = $(this).attr("data-hint"); var hintArray = hint.split(',') var t = tmp.split('-'); var table = t[0]; var id = t[1]; $('.e-rate').raty({ path : path, half : true, score : score, readOnly : readonly, hints : hintArray, // starOff : 'star_off_16.png', // starOn : 'star_on_16.png', // starHalf : 'star_half_16.png', // cancelOff : 'cancel-off-big.png', // cancelOn : 'cancel-on-big.png', // size : 16, target : '#e-rate-'+tmp, // targetType : 'number', targetText : $('#e-rate-'+tmp).text(), // cancel : true, // css : 'e-rate-star', click: function(score, evt) { $(this).find('img').unbind('click'); $(this).find('img').unbind(); $.ajax({ type: "POST", url: script + "?ajax_used=1", data: { table: table, id: id, score: score } }).done(function( msg ) { alert(msg); bla = msg.split('|'); $('#e-rate-'+tmp).text(bla[0]); if(bla[1]) { $('#e-rate-votes-'+tmp).text(bla[1]); } }); } }); }); // $( ".field-help" ).tooltip(); // Allow Tabs to be used inside textareas. $( 'textarea' ).keypress( function( e ) { if ( e.keyCode == 9 ) { e.preventDefault(); $( this ).val( $( this ).val() + '\t' ); } }); // Text-area AutoGrow $("textarea.e-autoheight").elastic(); }) // Legacy Stuff to be converted. // BC Expandit() function var nowLocal = new Date(); /* time at very beginning of js execution */ var localTime = Math.floor(nowLocal.getTime()/1000); /* time, in ms -- recorded at top of jscript */ function expandit(e) { var href = $(e).attr("href"); if(href === "#" || href == "") { idt = $(e).next("div"); $(idt).toggle("slow"); return false;; } var id = "#" + e; $(id).toggle("slow"); return false; }; var addinput = function(text,rep) { // quick fix to prevent JS errors - proper match was done only for latin words // var rep = text.match(/\=([^\]]*)\]/); // var rep = ''; var val = rep ? prompt(rep) : prompt('http://'); if(!val) { return; } var newtext = text.replace('*', val); emote = ''; addtext(newtext, emote); return; } function SyncWithServerTime(serverTime,domain) { if (serverTime) { /* update time difference cookie */ var serverDelta=Math.floor(localTime-serverTime); document.cookie = 'e107_tdOffset='+serverDelta+'; path=/; domain= .'+domain; document.cookie = 'e107_tdSetTime='+(localTime-serverDelta)+'; path=/; domain=.'+domain; /* server time when set */ } var tzCookie = 'e107_tzOffset='; // if (document.cookie.indexOf(tzCookie) < 0) { /* set if not already set */ var timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */ document.cookie = tzCookie + timezoneOffset+'; path=/; domain=.'+domain; // } } function urljump(url){ top.window.location = url; } function setInner(id, txt) { document.getElementById(id).innerHTML = txt; } function jsconfirm(thetext){ return confirm(thetext); } function insertext(str,tagid,display){ document.getElementById(tagid).value = str; if(display){ document.getElementById(display).style.display='none'; } } function appendtext(str,tagid,display){ document.getElementById(tagid).value += str; document.getElementById(tagid).focus(); if(display){ document.getElementById(display).style.display='none'; } } function open_window(url,wth,hgt) { if('full' == wth){ pwindow = window.open(url); } else { if (wth) { mywidth=wth; } else { mywidth=600; } if (hgt) { myheight=hgt; } else { myheight=400; } pwindow = window.open(url,'Name', 'top=100,left=100,resizable=yes,width='+mywidth+',height='+myheight+',scrollbars=yes,menubar=yes'); } pwindow.focus(); } function ejs_preload(ejs_path, ejs_imageString){ var ejs_imageArray = ejs_imageString.split(','); for(ejs_loadall=0; ejs_loadall