| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/central/assets/js/whmcs/ |
Upload File : |
/**
* WHMCS UI module
*
* @copyright Copyright (c) WHMCS Limited 2005-2017
* @license http://www.whmcs.com/license/ WHMCS Eula
*/
(function(module) {
if (!WHMCS.hasModule('ui')) {
WHMCS.loadModule('ui', module);
}
})({
/**
* Confirmation PopUp
*/
confirmation: function () {
/**
* @type {Array} Registered confirmation root selectors
*/
var toggles = [];
/**
* Register/Re-Register all confirmation elements with jQuery
* By default all elements of data toggle "confirmation" will be registered
*
* @param {(string|undefined)} rootSelector
* @return {Array} array of registered toggles
*/
this.register = function (rootSelector) {
if (typeof rootSelector === 'undefined') {
rootSelector = '[data-toggle=confirmation]';
}
if (toggles.indexOf(rootSelector) < 0) {
toggles.push(rootSelector);
}
jQuery(rootSelector).confirmation({
rootSelector: rootSelector
});
return toggles;
};
return this;
},
/**
* Data Driven Table
*/
dataTable: function () {
/**
* @type {{}}
*/
this.tables = {};
/**
* Register all tables on page with the class "data-driven"
*/
this.register = function () {
var self = this;
jQuery('table.data-driven').each(function (i, table) {
self.getTableById(table.id, undefined);
});
};
/**
* Get a table by id; create table object on fly as necessary
*
* @param {string} id
* @param {({}|undefined)} options
* @returns {DataTable}
*/
this.getTableById = function (id, options) {
var self = this;
var el = jQuery('#' + id);
if (typeof self.tables[id] === 'undefined') {
if (typeof options === 'undefined') {
options = {
dom: '<"listtable"ift>pl',
paging: false,
searching: false,
ordering: true,
info: false,
language: {
emptyTable: (el.data('lang-empty-table')) ? el.data('lang-empty-table') : "No records found"
},
ajax: {
url: el.data("ajax-url")
}
};
}
var ordering = el.data('ordering');
if (typeof ordering !== 'undefined') {
options["ordering"] = ordering;
}
var order = el.data('order');
if (typeof order !== 'undefined' && order) {
options["order"] = order;
}
var colCss = el.data('columns');
if (typeof colCss !== 'undefined' && colCss) {
options["columns"] = colCss;
}
var autoWidth = el.data('auto-width');
if (typeof autoWidth !== 'undefined') {
options["bAutoWidth"] = autoWidth;
}
self.tables[id] = self.initTable(el, options);
} else if (typeof options !== 'undefined') {
var oldTable = self.tables[id];
var initOpts = oldTable.init();
var newOpts = jQuery.extend( initOpts, options);
oldTable.destroy();
self.tables[id] = self.initTable(el, newOpts);
}
return self.tables[id];
};
this.initTable = function (el, options) {
var table = el.DataTable(options);
var self = this;
if (el.data('on-draw')) {
table.on('draw.dt', function (e, settings) {
var namedCallback = el.data('on-draw');
if (typeof window[namedCallback] === 'function') {
window[namedCallback](e, settings);
}
});
} else if (el.data('on-draw-rebind-confirmation')) {
table.on('draw.dt', function (e) {
self.rebindConfirmation(e);
});
}
return table;
};
this.rebindConfirmation = function (e) {
var self = this;
var tableId = e.target.id;
var toggles = WHMCS.ui.confirmation.register();
for(var i = 0, len = toggles.length; i < len; i++ ) {
jQuery(toggles[i]).on(
'confirmed.bs.confirmation',
function (e)
{
e.preventDefault();
jQuery.post(
jQuery(e.target).data('target-url'),
{
'token': csrfToken
}
).done(function (data)
{
if (data.status === 'success' || data.status === 'okay') {
self.getTableById(tableId, undefined).ajax.reload();
}
});
}
);
}
};
return this;
},
/**
* ToolTip and Clipboard behaviors
*/
toolTip: function () {
this.registerClipboard = function () {
var self = this;
jQuery('[data-toggle="tooltip"]').tooltip();
var clipboard = new Clipboard('.copy-to-clipboard');
clipboard.on('success', function(e) {
var btn = jQuery(e.trigger);
self.setTip(btn, 'Copied!');
self.hideTip(btn);
});
clipboard.on('error', function(e) {
self.setTip(e.trigger, 'Press Ctrl+C to copy');
self.hideTip(e.trigger);
});
$('.copy-to-clipboard').tooltip({
trigger: 'click',
placement: 'bottom'
});
};
this.setTip = function (btn, message) {
var tip = btn.data('bs.tooltip');
if (tip.hoverState !== 'in') {
tip.hoverState = 'in';
}
btn.attr('data-original-title', message);
tip.show();
return tip;
};
this.hideTip = function (btn) {
return setTimeout(function() {
btn.data('bs.tooltip').hide()
}, 2000);
}
}
});