PHP File Manager
Editing File: core.js
$(function() { $('.date_mask').datetimepicker({ mask: true, format: 'd/m/Y H:i' }); $('.datepick').datetimepicker({ format: 'd/m/Y H:i' }); $('.datepick_kickoff').datetimepicker({ format: 'd/m/Y H:i', allowTimes: [ '00:00', '00:15', '00:30', '00:45', '01:00', '01:15', '01:30', '01:45', '02:00', '02:15', '02:30', '02:45', '03:00', '03:15', '03:30', '03:45', '04:00', '04:15', '04:30', '04:45', '05:00', '05:15', '05:30', '05:45', '06:00', '06:15', '06:30', '06:45', '07:00', '07:15', '07:30', '07:45', '08:00', '08:15', '08:30', '08:45', '09:00', '09:15', '09:30', '09:45', '10:00', '10:15', '10:30', '10:45', '11:00', '11:15', '11:30', '11:45', '12:00', '12:15', '12:30', '12:45', '13:00', '13:15', '13:30', '13:45', '14:00', '14:15', '14:30', '14:45', '15:00', '15:15', '15:30', '15:45', '16:00', '16:15', '16:30', '16:45', '17:00', '17:15', '17:30', '17:45', '18:00', '18:15', '18:30', '18:45', '19:00', '19:15', '19:30', '19:45', '20:00', '20:15', '20:30', '20:45', '21:00', '21:15', '21:30', '21:45', '22:00', '22:15', '22:30', '22:45', '23:00', '23:15', '23:30', '23:45' ], step: 15 }); $('select.enhanced').select2(); $(document).ajaxComplete(function(event, xhr) { try { var requestData = $.parseJSON(xhr.responseText); if(requestData !== null) { if(typeof requestData.loginRequired !== 'undefined' || typeof requestData.unauthorized !== 'undefined') { window.location.replace(requestData.url); } } } catch(err){} }); $('#results-per-page').change(function() { $.cookie('results_per_page', $(this).val(), { expires: 120, path: '/' }); window.location.reload(); }); $('#navigation-toggle').click(function() { var self = $(this), sidebarNavigation = $('#navigation'), mainWrapper = $('#main-wrapper'), sidebarClosed = (parseInt(sidebarNavigation.css('margin-left')) < 0); self.animate({ left: (sidebarClosed) ? 205 : 0 }, 'fast'); sidebarNavigation.animate({ marginLeft: (sidebarClosed) ? 0 : -205 }, 'fast'); mainWrapper.animate({ marginFeft: (sidebarClosed) ? 206 : 0 }, 'fast'); }); $('#toggle-page-notes').click(function(event) { event.preventDefault(); var pageNotesPanel = $('#page-notes').toggleClass('panel-closed'); if(pageNotesPanel.hasClass('panel-closed')) { $.cookie('page_notes', 1, { expires: 120 }); } else { $.removeCookie('page_notes'); } }); $('.close', '#data-viewer').click(function() { $('#data-viewer').fadeOut('fast'); }); $('select[multiple]').each(function() { var thisSelect = $(this), selectedValues = $(':selected', thisSelect); $('option', thisSelect).on('mousedown', function(event) { var thisOption = $(this); console.log(thisOption.prop('selected')) thisOption.prop('selected', !thisOption.prop('selected')); console.log(thisOption.prop('selected')) }); }); $('select[multiple]').each(function() { var select = $(this), values = {}; $('option',select).each(function(i, option) { values[option.value] = option.selected; }) .click(function(event) { values[this.value] = !values[this.value]; $('option',select).each(function(i, option) { option.selected = values[option.value]; }); }); }); $(document.body).on('keypress.maxlength', 'input[maxlength], textarea[maxlength]', function(event) { var self = $(this), maxLength = +self.prop('maxlength'); if(maxLength > 0) { if((!event.ctrlKey && event.keyCode !== 65) && (event.keyCode !== 8 && event.keyCode !== 46) && self.val().length >= maxLength) { event.preventDefault(); } } }); $('.tooltipped').tooltip({ container: 'body', delay: 0, animation: false }); $('.add-datepicker').each(function() { var thisInput = $(this); thisInput.datepicker( { dateFormat: 'dd-mm-yy', minDate: thisInput.data('min-date'), maxDate: thisInput.data('max-date') }); }); $('.rdit-help', '#main-wrapper').click(function(event) { event.preventDefault(); var helpWindow = window.open('http://help.rdwd.co.uk/?section=' + (this.hash.replace(/#/, '')) + '&site=' + encodeURIComponent(window.location.host), 'RDIT Help Centre', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, height=670, width=620, top=30, left=300'); helpWindow.focus(); }); Chart.defaults.global.animation = false; Chart.defaults.global.responsive = true; Chart.defaults.global.maintainAspectRatio = false; }); var showDataViewer = function(callback) { var dataViewer = $('#data-viewer'), dataInnerWrapper = $('.inner', dataViewer).removeData().hide(); dataViewer.find('*').not('.close').off(); dataViewer.addClass('loading').fadeIn('fast', function() { callback(dataViewer, dataInnerWrapper); }) .find('.inner').empty(); }; var closeDataViewer = function() { $('.close', '#data-viewer').triggerHandler('click'); }; var recountSidebar = function() { var existingCounters = $('.label', '#navigation'); $.get('/', function(response) { $('#navigation .label', response).each(function(i) { existingCounters.eq(i).text($(this).text()); }); }, 'html'); }; var url_title = function(text) { return text.toString().toLowerCase() .replace(/\s+/g, '-') .replace(/[^\w\-]+/g, '') .replace(/\-\-+/g, '-') .replace(/^-+/, '') .replace(/-+$/, ''); }; var getObjectLength = function(data) { if($.isArray(data)) { return data.length; } else { var L = 0; $.each(data, function(i, elem) { L++; }); return L; } }; (function($){ $.fn.serializeObject = function () { "use strict"; var result = {}; var extend = function (i, element) { var node = result[element.name]; if ('undefined' !== typeof node && node !== null) { if ($.isArray(node)) { node.push(element.value); } else { result[element.name] = [node, element.value]; } } else { result[element.name] = element.value; } }; $.each(this.serializeArray(), extend); return result; }; })(jQuery); /*! * jQuery Cookie Plugin v1.4.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2006, 2014 Klaus Hartl * Released under the MIT license */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof exports === 'object') { // CommonJS factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { var pluses = /\+/g; function encode(s) { return config.raw ? s : encodeURIComponent(s); } function decode(s) { return config.raw ? s : decodeURIComponent(s); } function stringifyCookieValue(value) { return encode(config.json ? JSON.stringify(value) : String(value)); } function parseCookieValue(s) { if (s.indexOf('"') === 0) { // This is a quoted cookie as according to RFC2068, unescape... s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { // Replace server-side written pluses with spaces. // If we can't decode the cookie, ignore it, it's unusable. // If we can't parse the cookie, ignore it, it's unusable. s = decodeURIComponent(s.replace(pluses, ' ')); return config.json ? JSON.parse(s) : s; } catch(e) {} } function read(s, converter) { var value = config.raw ? s : parseCookieValue(s); return $.isFunction(converter) ? converter(value) : value; } var config = $.cookie = function (key, value, options) { // Write if (arguments.length > 1 && !$.isFunction(value)) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setTime(+t + days * 864e+5); } return (document.cookie = [ encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // Read var result = key ? undefined : {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. Also prevents odd result when // calling $.cookie(). var cookies = document.cookie ? document.cookie.split('; ') : []; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = parts.join('='); if (key && key === name) { // If second argument (value) is a function it's a converter... result = read(cookie, value); break; } // Prevent storing a cookie that we couldn't decode. if (!key && (cookie = read(cookie)) !== undefined) { result[name] = cookie; } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) === undefined) { return false; } // Must not alter options, thus extending a fresh object... $.cookie(key, '', $.extend({}, options, { expires: -1 })); return !$.cookie(key); }; })); (function($) { $.fn.outerHtml = function() { return $('<div />').append(this.clone()).html(); }; })(jQuery); Array.prototype.shuffle = function() { for(var i = this.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)), temp = this[i]; this[i] = this[j]; this[j] = temp; } return this; }
Cancel