| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/darkreachusa.com/public_html/cms_admin/includes/js/ |
Upload File : |
function StdPopulate(n_to)
{
var res = n_to.split(",");
for(var j = 0; j < res.length; j++)
{
ct = document.getElementById(res[j])
if (!ct) return false;
for (var i = 0; i < ct.length; i++)
{
ct.options[i].selected = true
}
}
return true;
}
function StdPopHidden(ct, textField)
{
cll = "";
for (var i = 0; i < ct.length; i++)
{
cll = cll + ct.options[i].value;
if (i != ct.length - 1)
{
cll = cll + ",";
}
}
$("#" + textField).val(cll);
return true
}
function StdDragstartHandler(ev) {
// Add the target element's id to the data transfer object
ev.dataTransfer.setData("application/appid", ev.target.id);
ev.dataTransfer.setData("application/allowdrag", $(ev.target).attr("allowdrag"));
ev.dataTransfer.setData("application/source", $("#" + ev.target.id).parent().attr("id") );
ev.dataTransfer.dropEffect = "move";
}
function StdDragoverHandler(ev)
{
ev.preventDefault();
ev.dataTransfer.dropEffect = "move"
}
function StdDropHandler(ev)
{
ev.preventDefault();
// Get the id of the target and add the moved element to the target's DOM
const data = ev.dataTransfer.getData("application/appid");
drag = ev.dataTransfer.getData("application/allowdrag");
source = ev.dataTransfer.getData("application/source");
if (drag == "undefined")
{
alert("allowdrag is undefined for source element");
return;
}
drag = drag.split(",");
if (drag.indexOf(ev.target.id) == -1)
{
return;
}
$(data).attr("allowdrag", $(ev.target).attr("allowdrag") )
ev.target.appendChild(document.getElementById(data));
// Reset handlers for option after drag.
$(document.getElementById(data)).attr("allowdrag", $(document.getElementById(data).parentNode).attr("allowdrag"));
if ( typeof $(ev.target).data("populate") != "undefined")
{
StdPopHidden(ev.target, $(ev.target).data("populate"))
}
if ( typeof $("#" + source).data("populate") != "undefined")
{
StdPopHidden(document.getElementById(source), $("#" + source).data("populate"))
}
if ( typeof $("#" + source).data("afterfunc") != "undefined")
{
afterfunc = $("#" + source).data("afterfunc");
window[afterfunc](ycat)
}
}
function showsug()
{
$('.suggest_popup_wrapper').show();
$("#mask").show();
return false;
}
function hidesug()
{
$('.suggest_popup_wrapper').hide();
$("#mask").hide();
return false;
}
function submitsug(v)
{
url = hpth + "ajax_suggestion.php";
formdata = {};
formdata.location = document.location + "";
formdata.text = v.sugtxt.value;
$.ajax({
url: url,
type: "POST",
data : formdata,
})
.fail(function(jqXHR, textStatus, errorThrown ) {
alert("There may have been an error recording your setting. Please try again later (" + textStatus + ")\n" + errorThrown + "\n\n" + jqXHR.responseText)
return;
})
.done(function( dtt ) {
var data;
try
{
data = $.parseJSON(dtt);
}
catch(e)
{
alert("Error:\n " + dtt)
return false;
}
if (data.success == 1)
{
alert("Thank you. Your suggestion has been submitted");
hidesug();
}
else
{
alert("There may have been an error recording your setting. Please try again later.\nError:\n\n" + data.errmsg);
return;
}
});
return false;
}
var blockstyle = "";
$( document ).ready(function() {
blockstyle = $(".nav_table").css("display")
});
function togglenav()
{
if ( $(".left_nav_showhide").css("display") != "none" && $(".nav_table").css("display") == "table")
{
return;
}
$(".left_nav_showhide").slideToggle();
}
function toggleindex(nd)
{
if ( $(".index_showhide").css("display") != "none" && $(".nav_table").css("display") == "table")
{
return;
}
$("#" + nd).slideToggle();
}
$( window ).resize(function() {
if (blockstyle != $(".nav_table").css("display"))
{
if ($(".nav_table").css("display") == "table")
{
$(".left_nav_showhide").show();
$(".index_showhide").show();
}
else
{
$(".left_nav_showhide").hide();
$(".index_showhide").hide();
}
blockstyle = $(".nav_table").css("display")
}
});
$(document).ready(function() {
$(window).on('load',function(){
if ($('.login-popup').attr('closed') != "1")
{
$('.login-popup').fadeIn(300);
}
return false;
});
// When clicking on the button close or the mask layer the popup closed
$('a.close').click(function() {
$('.login-popup').attr('closed', 1);
$('#mask , .login-popup').fadeOut(300 , function() {
if ((typeof(newsid) !== 'undefined') && newsid != "")
{
$.post( hpth + "newsupdates.php", { newsread: "1", newsid: newsid, admin: adminid } );
}
});
return false;
});
});
function getRequest()
{
try
{
var requester = new XMLHttpRequest();
}
catch (error)
{
try
{
var requester = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (error)
{
return false;
}
}
return requester
}
this.imagePreview = function(){
/* CONFIG */
c_top = "";
c_left = "";
c_right = "";
c_bottom = "";
currelem = null;
t_width = 0;
timeoutId2 = null;
touchart = 0;
snap = "";
fadeaway = 250;
var ua = navigator.userAgent;
var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua);
var fingerC = 0;
// If we're on an iDevice, don't go to the URL directly,
// and rely on double-tap in order to follow through.
$(".elevpreview").bind("click", (function(e){
return true;
}));
// If anywhere on the screen is touched
// it should close any popup windows as long as
// The element touched isn't part of .elevpreview
function clearcurrelem()
{
currelem = null;
}
function clearhover()
{
hoverout(this);
}
function onhover(e, ths)
{
if (currelem != $(ths).attr("tooltip"))
{
hoverout(this);
}
window.clearTimeout(timeoutId2);
if (currelem == $(ths).attr("tooltip"))
{
return;
}
ths.t = ths.title;
ths.title = "";
var txn = $(ths).attr('tooltip')
if ($(ths).attr('snap'))
{
snap = $(ths).attr('snap')
}
if ($(ths).attr('fadeaway'))
{
fadeaway = parseInt($(ths).attr('fadeaway'))
}
if ($(ths).attr('offset_top'))
{
c_top = parseInt($(ths).attr('offset_top'))
}
if ($(ths).attr('offset_bottom'))
{
c_bottom = parseInt($(ths).attr('offset_bottom'))
}
if ($(ths).attr('offset_left'))
{
c_left = parseInt($(ths).attr('offset_left'))
}
if ($(ths).attr('offset_right'))
{
c_right = parseInt($(ths).attr('offset_right'))
}
if ($(ths).attr('tooltip_width'))
{
t_width = parseInt($(ths).attr('tooltip_width'))
}
else
{
t_width = $("#preview").width();
}
var txt = "<p id='preview'>" + $("#"+txn).html() + "</p>"
$("body").append(txt);
position = $(ths).position();
pageY = position.top;
pageX = position.left;
if (c_bottom != "")
$("#preview").css("top",(pageY + c_bottom) + "px");
if (c_right != "")
$("#preview").css("left",(pageX + c_right) + "px");
if (c_left != "")
$("#preview").css("left",(pageX - c_left - t_width) + "px");
if (c_top != "")
$("#preview").css("top",(pageY - c_top - $("#preview").height()) + "px");
if (t_width != 0)
{
$("#preview").css("width", t_width + "px");
$("#preview").css("max-width", t_width + "px");
}
$("#preview").fadeIn("fast");
currelem = $(ths).attr("tooltip")
$("#preview .ajaxtoggle").click(function(e){
ajaxh(e, this);
});
$("#preview .ajaxtoggle").each(function(e){
loadajaxh(e, this);
});
}
function hoverout(ths)
{
ths.title = ths.t;
$("#preview").remove();
currelem = "";
}
$(".elevpreview").mousemove(function(e){
if (snap != "cursor")
{
return;
}
if (c_bottom != "")
$("#preview").css("top",(e.pageY + c_bottom) + "px");
if (c_right != "")
$("#preview").css("left",(e.pageX + c_right) + "px");
if (c_left != "")
$("#preview").css("left",(e.pageX - c_left - $("#preview").width()) + "px");
if (c_top != "")
$("#preview").css("top",(e.pageY - c_top - $("#preview").height()) + "px");
});
$(".elevpreview").hover(function(e){
onhover(e, this);
$("#preview").hover(function(e){
window.clearTimeout(timeoutId2);
},
function(){
timeoutId2 = window.setTimeout(clearhover, fadeaway, true);
});
},
function(){
timeoutId2 = window.setTimeout(clearhover, fadeaway, true);
});
};
function loadajaxh(e, ths)
{
id_attr = $(ths).attr("id");
checked = ($(ths).is(':checked')) ? 1 : 0;
url = $(ths).attr("url") + "";
if (url != "")
{
url = url + "&get=1";
$.ajax({
url: url,
context: document.body,
success: function(data){
if (data == 1)
{
$(ths).attr('checked','checked');
}
else
{
$(ths).removeAttr('checked');
}
}
});
}
}
function ajaxh(e, ths)
{
id_attr = $(ths).attr("id");
checked = ($(ths).is(':checked')) ? 1 : 0;
url = $(ths).attr("url") + "";
if (url != "")
{
url = url + "&toggle=" + checked;
$.ajax({
url: url,
context: document.body
});
}
}
$(document).ready(function(){
imagePreview();
var $chkboxes = $('.checkselect');
var lastChecked = null;
$chkboxes.click(function(e) {
if(!lastChecked) {
lastChecked = this;
return;
}
if(e.shiftKey) {
var start = $chkboxes.index(this);
var end = $chkboxes.index(lastChecked);
$chkboxes.slice(Math.min(start,end), Math.max(start,end)+ 1).prop('checked', lastChecked.checked);
}
lastChecked = this;
});
});
// Function for selecting everything in a Select2 style box.
function SelectUnselectAll(cnt)
{
if (!isNaN(parseFloat(cnt)) && isFinite(cnt))
{
nodename = "#select2_item_" + cnt
}
else
{
nodename = "#" + cnt;
}
ht = $("#selectall_id_" + cnt).html();
if (ht == "Select All")
{
$("#selectall_id_" + cnt).html("Clear All");
$(nodename + " > option:not([disabled])").prop("selected","selected");
}
else
{
$("#selectall_id_" + cnt).html("Select All");
$(nodename).val('');
}
$(nodename).trigger("change");
$(nodename).select2('close');
}
// Functions for selecting everything in a Select2 + SortableJS style box
function SelectSortableUnselectAll(cnt)
{
ht = $("#selectall_sortable_id_" + cnt).html();
if (ht == "Select All")
{
name = $("#sortable_item" + cnt).data("name");
$("#selectall_sortable_id_" + cnt).html("Clear All");
$("#select2_sortable_item_" + cnt + " > option").each(function() {
key = $(this).val();
label = $(this).text();
txt = '<div class="sortable_item">'
txt = txt + '<input type="hidden" id="sortable_item_' + cnt + '_' + key + '" '
if (name != "")
{
txt = txt + 'name="' + name + '" '
}
txt = txt + ' value="' + key + '"'
txt = txt + ' data-label="' + label + '" readonly /> '
if ($("#select2_sortable_item_" + cnt).data("url") != undefined)
{
txt = txt + "<a target=\"_blank\" href=\"" + $("#select2_sortable_item_" + cnt).data("url") + key + "\">👁 </a> "
}
txt = txt + label + " "
txt = txt + '<a class="menulink nowrap" href="javascript:RemoveSortableItem(\'' + cnt + '\', \'' + key + '\')">[- Remove]</a>'
txt = txt + '</div>'
$("#sortable_item" + cnt).append(txt);
$(this).remove();
$("#sortable_item" + cnt + " .sortable_no_items").addClass("hid");
});
}
else
{
$("#selectall_sortable_id_" + cnt).html("Select All");
$("#sortable_item" + cnt + " > div.sortable_item").each(function() {
id = $("input", this).val();
label = $("input", this).data("label");
$(this).remove();
txt = '<option value="' + id + '">' + label + "</option>";
$("#select2_sortable_item_" + cnt).append(txt);
$("#sortable_item" + cnt + " .sortable_no_items").removeClass("hid");
});
}
$("#select2_sortable_item_" + cnt).trigger("change");
if ($("#sortable_item" + cnt).data("populate") != "")
{
pop = $("#sortable_item" + cnt).data("populate");
var cll = [];
$("#sortable_item" + cnt + " input").each( function() {
cll[cll.length] = this.value;
})
$("#" + pop).val(cll.join(","));
}
let funcName = "Sortable_onUpdate_" + cnt;
if (typeof window[funcName] === "function") {
window[funcName]();
}
}
function RemoveSortableItem(cnt, key)
{
id = $('#sortable_item_' + cnt + '_' + key).val();
label = $('#sortable_item_' + cnt + '_' + key).data("label");
dv = $('#sortable_item_' + cnt + '_' + key).parent();
txt = '<option value="' + id + '">' + label + "</option>";
$("#select2_sortable_item_" + cnt).append(txt);
$("#select2_sortable_item_" + cnt).trigger("change");
$(dv).remove();
if ($("#sortable_item" + cnt + " > div.sortable_item").length == 0)
{
$("#sortable_item" + cnt + " .sortable_no_items").removeClass("hid");
$("#selectall_sortable_id_" + cnt).html("Select All");
}
if ($("#sortable_item" + cnt).data("populate") != "")
{
pop = $("#sortable_item" + cnt).data("populate");
var cll = [];
$("#sortable_item" + cnt + " input").each( function() {
cll[cll.length] = this.value;
})
$("#" + pop).val(cll.join(","));
}
let funcName = "Sortable_onUpdate_" + cnt;
if (typeof window[funcName] === "function") {
window[funcName]();
}
}
function AddSortableItem(cnt)
{
if ($("#select2_sortable_item_" + cnt + ' option:selected').length == 0)
{
return;
}
v = $("#select2_sortable_item_" + cnt);
key = $(v).val();
label = $("#select2_sortable_item_" + cnt + ' option:selected').text();
name = $("#sortable_item" + cnt).data("name");
txt = '<div class="sortable_item">'
txt = txt + '<input type="hidden" id="sortable_item_' + cnt + '_' + key + '" name="' + name + '" value="' + key + '"'
txt = txt + ' data-label="' + label + '" readonly /> '
if (v.data("url") != undefined)
{
txt = txt + "<a target=\"_blank\" href=\"" + v.data("url") + key + "\"><i class='fa fa-eye' aria-hidden='true'></i> </a> "
}
txt = txt + label + " "
txt = txt + '<a class="menulink" href="javascript:RemoveSortableItem(\'' + cnt + '\', \'' + key + '\')">[- Remove]</a>'
txt = txt + '</div>'
$("#sortable_item" + cnt).append(txt);
$("#select2_sortable_item_" + cnt + ' option:selected').remove();
$("#sortable_item" + cnt + " .sortable_no_items").addClass("hid");
if ($("#select2_sortable_item_" + cnt + ' option').length == 0)
{
$("#selectall_sortable_id_" + cnt).html("Clear All");
}
if ($("#sortable_item" + cnt).data("populate") != "")
{
pop = $("#sortable_item" + cnt).data("populate");
var cll = [];
$("#sortable_item" + cnt + " input").each( function() {
cll[cll.length] = this.value;
})
$("#" + pop).val(cll.join(","));
}
let funcName = "Sortable_onUpdate_" + cnt;
if (typeof window[funcName] === "function") {
window[funcName]();
}
}