JAVASCRIPT   21
functions
Guest on 18th September 2023 07:52:47 AM


  1. (function(e, g) {
  2.     g.Functions = can.Construct.extend({
  3.         addParamsToUrl: function(a, c) {
  4.             e.each(c, function(b, c) {
  5.                 a = g.Functions.addParamToUrl(a, b, c)
  6.             });
  7.             return a
  8.         },
  9.         addParamToUrl: function(a, c, b) {
  10.             var d = a.indexOf("?"),
  11.                 f = a.indexOf("#");
  12.             d == a.length - 1 && (a = a.substring(0, d), d = -1);
  13.             return (0 < f ? a.substring(0, f) : a) + (0 < d ? "&" + c + "=" + b : "?" + c + "=" + b) + (0 < f ? a.substring(f) : "")
  14.         },
  15.         removeParamsFromUrl: function(a, c) {
  16.             for (var b in c) a = g.Functions.removeParamFromUrl(a, c[b]);
  17.             return a
  18.         },
  19.         removeParamFromUrl: function(a, c) {
  20.             var b = a.match(new RegExp(c +
  21.                 "\\=([a-z0-9]+)", "i"));
  22.             b && (b = b[0], 0 <= a.search("&" + b) ? a = a.replace("&" + b, "") : 0 <= a.search("\\?" + b + "&") ? a = a.replace("?" + b + "&", "?") : 0 <= a.search("\\?" + b) && (a = a.replace("?" + b, "")));
  23.             return a
  24.         },
  25.         MSG_ERROR_TYPE: "error",
  26.         MSG_INFO_TYPE: "info",
  27.         MSG_SUCCESS_TYPE: "success",
  28.         showMessage: function(a, c) {
  29.             c = "undefined" === typeof c ? "info" : c;
  30.             var b = e("#mpsl-info-box"),
  31.                 d = e("<div />", {
  32.                     "class": "mpsl-message mpsl-message-" + c,
  33.                     html: a
  34.                 }),
  35.                 f = e("<i />", {
  36.                     "class": "error" === c ? "mpsl-icon-error" : "mpsl-icon-info"
  37.                 });
  38.             d.prepend(f);
  39.             b.append(d);
  40.             var h =
  41.                 setTimeout(function() {
  42.                     d.remove();
  43.                     clearTimeout(h)
  44.                 }, 1E4);
  45.             return !0
  46.         },
  47.         getScrollbarWidth: function() {
  48.             var a = window.browserScrollbarWidth;
  49.             if ("undefined" === typeof a) {
  50.                 var c = e('<div style="width: 50px; height: 50px; position: absolute; left: -100px; top: -100px; overflow: auto;"><div style="width: 1px; height: 100px;"></div></div>');
  51.                 e("body").append(c);
  52.                 a = c[0].offsetWidth - c[0].clientWidth;
  53.                 c.remove()
  54.             }
  55.             return a
  56.         },
  57.         uniqid: function(a, c) {
  58.             "undefined" == typeof a && (a = "");
  59.             var b, d = function(a, b) {
  60.                 a = parseInt(a, 10).toString(16);
  61.                 return b < a.length ? a.slice(a.length - b) : b > a.length ? Array(1 + (b - a.length)).join("0") + a : a
  62.             };
  63.             this.php_js || (this.php_js = {});
  64.             this.php_js.uniqidSeed || (this.php_js.uniqidSeed = Math.floor(123456789 * Math.random()));
  65.             this.php_js.uniqidSeed++;
  66.             b = a + d(parseInt((new Date).getTime() / 1E3, 10), 8);
  67.             b += d(this.php_js.uniqidSeed, 5);
  68.             c && (b += (10 * Math.random()).toFixed(8).toString());
  69.             return b
  70.         },
  71.         disableSelection: function(a) {
  72.             a.attr("unselectable", "on").css({
  73.                 "-moz-user-select": "-moz-none",
  74.                 "-moz-user-select": "none",
  75.                 "-o-user-select": "none",
  76.                 "-khtml-user-select": "none",
  77.                 "-webkit-user-select": "none",
  78.                 "-ms-user-select": "none",
  79.                 "user-select": "none"
  80.             }).bind("selectstart", function() {
  81.                 return !1
  82.             })
  83.         }
  84.     }, {})
  85. })(jQuery, MPSL);
  86. jQuery(function(e) {
  87.     e("#mpsl-info-box").on("click", ".mpsl-message", function(g) {
  88.         e(this).remove()
  89.     })
  90. });

Raw Paste

Login or Register to edit or fork this paste. It's free.