jQuery(function($) { $('.target_blank') .attr({ 'target': '_blank' }); $('.confirm') .each(function() { var $this = $(this); var message = $this.attr('title') || 'Are you sure?'; $this .click(function(e) { if (!confirm(message)) { e .preventDefault(); } }); }) .removeAttr('title'); $('.numbersOnly').bind("keyup change", function(e) { this.value = this.value.replace(/[^0-9\.:]/g,''); }); /* PopUp */ $('.showPop').click(function(){ load = $(this).attr('data-load'); custom = $(this).attr('data-custom'); $.ajax({ url: '/ajax/root.php', data: { 'popup': 'yes', 'load': load, 'custom': custom, }, type: 'POST', dataType: 'html', success: function(receivedData) { if(receivedData == 'error'){ window.location.href = '/'; }else{ $('head').append(''); $('#popup>.body .inside').html(receivedData); $('#popup').show(); $('#popup>.body').css({ 'margin-top': ($(document).scrollTop() + 50) + 'px', 'margin-right': 'auto', 'margin-bottom': 'auto', 'margin-left': 'auto', }); } } }); }); /* END PopUp */ $('#popup>.body .close').click(function(){ $('#popup').hide(); $('#popup>.body .title').html(''); $('#popup>.body .inside').html(''); }); $('.selectBox>select').change(function(){ $this = $(this); option = $this.find("option:selected").text(); $this.parent('div').find('div').text(option); }); $('.search').click(function () { $("#searchFrom").submit(); }); $('#showMenu').click(function () { $('#menu').toggle(300); }); $(document).one('focus.autoExpand', 'textarea.autoExpand', function(){ var savedValue = this.value; this.value = ''; this.baseScrollHeight = this.scrollHeight; this.value = savedValue; }).on('input.autoExpand', 'textarea.autoExpand', function(){ var minRows = this.getAttribute('data-min-rows')|0, rows; this.rows = minRows; rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16); this.rows = minRows + rows; }); $( document ).ready(function() { $('.autoExpand').each(function() { var savedValue = this.value; this.value = ''; this.baseScrollHeight = this.scrollHeight; this.value = savedValue; var minRows = this.getAttribute('data-min-rows')|0, rows; this.rows = minRows; rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16); this.rows = minRows + rows; }); }); $('textarea').keyup(function(e){ if(this.value.length > 160){ if (e.keyCode != 8) { return false; } } $("#remainingC").text("Remaining characters : " +(160 - this.value.length)); }); $('.emoticons').click(function(){ $('.showEmoji').toggle(); }); $('.showEmoji > img').click(function(){ emot = $(this).attr('data-emot'); $('#addComment').val(function(i, text) { return text + ' (' + emot + ') '; }); $('.showEmoji').hide(); $('#addComment').focus(); }); $(document).ready(function(){ $footerHeight = $('footer').height(); $wrapperHeight = $('#wrapper').height(); $totHeight = $footerHeight + $wrapperHeight; $windowHeight = $(window).height(); if($totHeight < $windowHeight){ $raz = $windowHeight - $totHeight; $('#footerFix').css('min-height', $raz + 'px'); } }); $(window).resize(function(){ $footerHeight = $('footer').height(); $wrapperHeight = $('#wrapper').height(); $totHeight = $footerHeight + $wrapperHeight; $windowHeight = $(window).height(); if($totHeight < $windowHeight){ $raz = $windowHeight - $totHeight; $('#footerFix').css('min-height', $raz + 'px'); } }); }); function createCookie(name, value, days) { var date, expires; if (days) { date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "; expires="+date.toGMTString(); } else { expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; var d = document.getElementById(name); d.className += " hidden"; }