Advertisement
quasemineira

Untitled

May 18th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(f) {
  2.     f.fn.WR_ImagesLoaded = function(k) {
  3.         var i = function(m, n) {
  4.             var l = new Image;
  5.             l.onload = n;
  6.             l.src = m
  7.         };
  8.         var h = this.find("img").toArray().map(function(l) {
  9.             return l.src
  10.         });
  11.         if (h.length) {
  12.             var j = 0;
  13.             f(h).each(function(l, m) {
  14.                 i(m, function() {
  15.                     j++;
  16.                     if (j == h.length) {
  17.                         k()
  18.                     }
  19.                 })
  20.             })
  21.         } else {
  22.             k()
  23.         }
  24.     };
  25.  
  26.     function e() {
  27.         var i = f("#tabs-container .nitro-nav"),
  28.             k = f("#tabs-container .tab-pane"),
  29.             h = f(".trigger-tab"),
  30.             j = window.location.hash;
  31.         i.click(function(l) {
  32.             l.preventDefault();
  33.             f(this).addClass("active").siblings().removeClass("active");
  34.             k.removeClass("active").filter(f(l.target).attr("href")).addClass("active");
  35.             history.pushState({}, "", f(l.target).attr("href"))
  36.         });
  37.         h.on("click", function(l) {
  38.             l.preventDefault();
  39.             i.filter('[href="' + f(l.target).attr("href") + '"]').trigger("click")
  40.         });
  41.         if (j) {
  42.             i.removeClass("active").filter('[href="' + j + '"]').addClass("active");
  43.             k.removeClass("active").filter(j).addClass("active")
  44.         } else {
  45.             i.eq(0).addClass("active").siblings().removeClass("active");
  46.             k.removeClass("active").filter(i.eq(0).attr("href")).addClass("active")
  47.         }
  48.     }
  49.  
  50.     function c() {
  51.         f(".wr-scroll-animated").click(function() {
  52.             if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) {
  53.                 var i = f(this.hash);
  54.                 var h = f("#wpadminbar").outerHeight();
  55.                 i = i.length ? i : f("[name=" + this.hash.slice(1) + "]");
  56.                 if (i.length) {
  57.                     f("html,body").animate({
  58.                         scrollTop: i.offset().top - h - 100 + "px"
  59.                     }, 800);
  60.                     return false
  61.                 }
  62.             }
  63.         })
  64.     }
  65.  
  66.     function d() {
  67.         f('a[target="thickbox"]').each(function(h, j) {
  68.             if (!f(j).prop("wr_override_thickbox")) {
  69.                 f(j).click(function(o) {
  70.                     o.preventDefault();
  71.                     var n = f(this).attr("data-width"),
  72.                         i = f(this).attr("data-height");
  73.                     if (n.substr(-1) == "%") {
  74.                         n = f(window).width() * (parseInt(n) / 100)
  75.                     }
  76.                     if (i.substr(-1) == "%") {
  77.                         i = f(window).height() * (parseInt(i) / 100)
  78.                     }
  79.                     var m = f(this).attr("href") + (f(this).attr("href").indexOf("?") > -1 ? "&" : "?") + "width=" + n + "&height=" + i;
  80.                     tb_show(f(this).attr("title"), m);
  81.                     f("#TB_closeWindowButton, #TB_overlay").off("click", tb_remove);
  82.                     var k = this,
  83.                         l = function() {
  84.                             var q = f(k).attr("data-width"),
  85.                                 p = f(k).attr("data-height");
  86.                             if (q.substr(-1) == "%") {
  87.                                 q = f(window).width() * (parseInt(q) / 100)
  88.                             }
  89.                             if (p.substr(-1) == "%") {
  90.                                 p = f(window).height() * (parseInt(p) / 100)
  91.                             }
  92.                             TB_WIDTH = (q * 1) + 30;
  93.                             TB_HEIGHT = (p * 1) + 40;
  94.                             ajaxContentW = TB_WIDTH - 30;
  95.                             ajaxContentH = TB_HEIGHT - 45;
  96.                             f("#TB_ajaxContent").css({
  97.                                 width: ajaxContentW,
  98.                                 height: ajaxContentH
  99.                             });
  100.                             f("#TB_iframeContent").css({
  101.                                 width: ajaxContentW + 29,
  102.                                 height: ajaxContentH + 17
  103.                             });
  104.                             tb_position()
  105.                         };
  106.                     f(window).on("resize", l);
  107.                     f("#TB_closeWindowButton, #TB_overlay").click(function(q) {
  108.                         q.preventDefault();
  109.                         var p = f("#TB_closeWindowButton").attr("data-prevent-close");
  110.                         if (p) {
  111.                             if (f(this).attr("id") == "TB_closeWindowButton") {
  112.                                 return alert(p)
  113.                             }
  114.                         } else {
  115.                             tb_remove(q)
  116.                         }
  117.                         f(window).off("resize", l)
  118.                     });
  119.                     return false
  120.                 });
  121.                 f(j).prop("wr_override_thickbox", true)
  122.             }
  123.         })
  124.     }
  125.  
  126.     function b() {
  127.         var h;
  128.         f("#plugins").on("click", ".install-plugin, .uninstall-plugin", function(j) {
  129.             j.preventDefault();
  130.             if (f(this).attr("disabled")) {
  131.                 return
  132.             }
  133.             var l = f(this).hasClass("install-plugin") ? "install" : "uninstall";
  134.             var i = f.trim(f(this).prev().text().replace(/[\s\t\r\n]{2,99}/g, " "));
  135.             if (confirm(wr_nitro_admin["confirm_" + l + "_plugin"].replace("%PLUGIN%", i))) {
  136.                 f(this).hide().after('<span class="spinner is-active"></span>');
  137.                 var k = f.proxy(function() {
  138.                     if ("install" == l) {
  139.                         switch (h) {
  140.                             case "js_composer":
  141.                                 return setTimeout(k, 1000);
  142.                                 break
  143.                         }
  144.                         h = f(this).attr("data-plugin")
  145.                     }
  146.                     f.ajax({
  147.                         context: this,
  148.                         url: wr_nitro_admin[l + "_plugin_url"],
  149.                         type: "POST",
  150.                         dataType: "json",
  151.                         data: {
  152.                             plugin: f(this).attr("data-plugin"),
  153.                             nonce: wr_nitro_admin[l + "_plugin_nonce"]
  154.                         },
  155.                         complete: function(m) {
  156.                             if (!m.responseJSON && (m.responseJSON = m.responseText.match(/\{"success":.+\}/))) {
  157.                                 m.responseJSON = f.parseJSON(m.responseJSON[0])
  158.                             }
  159.                             if (!m.responseJSON || !m.responseJSON.success) {
  160.                                 if (m.responseJSON && m.responseJSON.data) {
  161.                                     alert(m.responseJSON.data)
  162.                                 } else {
  163.                                     alert(m.responseText ? m.responseText : wr_nitro_admin.unknown_error)
  164.                                 }
  165.                                 "install" == l && (h = null)
  166.                             } else {
  167.                                 f(this).removeClass(l + "-plugin").addClass((l == "install" ? "uninstall" : "install") + "-plugin");
  168.                                 f(this).text(wr_nitro_admin[l == "install" ? "uninstall" : "install"]);
  169.                                 if ("install" == l) {
  170.                                     switch (h) {
  171.                                         case "js_composer":
  172.                                             f.ajax({
  173.                                                 url: ajaxurl.replace("admin-ajax.php", "index.php"),
  174.                                                 complete: function() {
  175.                                                     h = null
  176.                                                 }
  177.                                             });
  178.                                             break;
  179.                                         default:
  180.                                             h = null;
  181.                                             break
  182.                                     }
  183.                                 }
  184.                             }
  185.                             f(this).show().next().remove()
  186.                         }
  187.                     })
  188.                 }, this);
  189.                 k()
  190.             }
  191.         })
  192.     }
  193.  
  194.     function g() {
  195.         f("#demos .install-sample, #demos .uninstall-sample").click(function(h) {
  196.             h.preventDefault();
  197.             if (f(this).attr("disabled")) {
  198.                 return
  199.             }
  200.             var j = f(this).hasClass("install-sample") ? "install" : "uninstall";
  201.             var o = f.trim(f(this).parent().children("h5").text().replace(/[\s\t\r\n]{2,99}/g, " "));
  202.             var p = function(s) {
  203.                     f("#TB_closeWindowButton").attr("data-prevent-close", wr_nitro_admin.close_prevented);
  204.                     var r = "package=" + s + "&step=2&nonce=" + wr_nitro_admin.install_sample_nonce + "&" + f("#sample-data-installation-options input").serialize();
  205.                     f.ajax({
  206.                         url: wr_nitro_admin.install_sample_url,
  207.                         dataType: "json",
  208.                         data: r,
  209.                         complete: function(t) {
  210.                             if (!t.responseJSON || !t.responseJSON.success) {
  211.                                 f("#wr-install-sample-data-download-package .spinner").removeClass("spinner").addClass("dashicons dashicons-no-alt");
  212.                                 f("#wr-install-sample-data-download-package .wr-status").removeClass("hidden");
  213.                                 if (t.responseJSON && t.responseJSON.data) {
  214.                                     f("#wr-install-sample-data-download-package .wr-status").html(t.responseJSON.data)
  215.                                 } else {
  216.                                     if (t.responseText) {
  217.                                         f("#wr-install-sample-data-download-package .wr-status").html(t.responseText)
  218.                                     } else {
  219.                                         f("#wr-install-sample-data-download-package .wr-status").html(wr_nitro_admin.unknown_error)
  220.                                     }
  221.                                 }
  222.                                 if (f('#sample-data-installation-options input[name="option"]:checked').val() == "page") {
  223.                                     return m()
  224.                                 }
  225.                                 return l(s)
  226.                             }
  227.                             f("#wr-install-sample-data-download-package .spinner").removeClass("spinner").addClass("dashicons dashicons-yes");
  228.                             i(s)
  229.                         }
  230.                     })
  231.                 },
  232.                 l = function(r) {
  233.                     f("#TB_closeWindowButton").removeAttr("data-prevent-close");
  234.                     f("#wr-install-sample-data-manually").removeClass("hidden");
  235.                     f("#wr-upload-sample-data").load(function(s) {
  236.                         var t = f(this).contents().find("body").text(),
  237.                             u = f.parseJSON(t);
  238.                         if (!u || !u.success) {
  239.                             f("#wr-install-sample-data-upload-package .spinner").removeClass("spinner").addClass("dashicons dashicons-no-alt");
  240.                             f("#wr-install-sample-data-upload-package .wr-status").removeClass("hidden");
  241.                             if (u && u.data) {
  242.                                 f("#wr-install-sample-data-upload-package .wr-status").html(u.data)
  243.                             } else {
  244.                                 if (t) {
  245.                                     f("#wr-install-sample-data-upload-package .wr-status").html(t)
  246.                                 } else {
  247.                                     f("#wr-install-sample-data-upload-package .wr-status").html(wr_nitro_admin.unknown_error)
  248.                                 }
  249.                             }
  250.                             return m()
  251.                         }
  252.                         f("#wr-install-sample-data-upload-package .spinner").removeClass("spinner").addClass("dashicons dashicons-yes");
  253.                         i(r)
  254.                     });
  255.                     f("#wr-upload-sample-data-package").click(function() {
  256.                         f("#wr-install-sample-data-upload-package").removeClass("hidden");
  257.                         f("#wr-install-sample-data-manually").addClass("hidden");
  258.                         var s = f(this.form).find('input[name="nonce"]');
  259.                         if (!s.length) {
  260.                             s = f('<input name="nonce" value="" />').appendTo(this.form)
  261.                         }
  262.                         s.val(wr_nitro_admin.install_sample_nonce);
  263.                         f(this.form).submit()
  264.                     })
  265.                 },
  266.                 i = f.proxy(function(s) {
  267.                     f("#TB_closeWindowButton").attr("data-prevent-close", wr_nitro_admin.close_prevented);
  268.                     f("#wr-install-sample-data-import-data").removeClass("hidden");
  269.                     var r = wr_nitro_admin.install_sample_url + "&package=" + s + "&step=3&nonce=" + wr_nitro_admin.install_sample_nonce + "&" + f("#sample-data-installation-options input").serialize();
  270.                     f("#nitro-manipulate-sample-data").off("load").load(f.proxy(function(u) {
  271.                         var t = {
  272.                             responseText: f(u.target).contents().find("body").text(),
  273.                             responseJSON: f(u.target).contents().find("body").text().match(/\{"success":.+\}/)
  274.                         };
  275.                         if (t.responseJSON) {
  276.                             t.responseJSON = f.parseJSON(t.responseJSON[0])
  277.                         }
  278.                         if (!t.responseJSON || !t.responseJSON.success) {
  279.                             f("#wr-install-sample-data-import-data .spinner").removeClass("spinner").addClass("dashicons dashicons-no-alt");
  280.                             f("#wr-install-sample-data-import-data .wr-status").removeClass("hidden");
  281.                             if (t.responseJSON && t.responseJSON.data) {
  282.                                 f("#wr-install-sample-data-import-data .wr-status").html(t.responseJSON.data)
  283.                             } else {
  284.                                 if (t.responseText) {
  285.                                     f("#wr-install-sample-data-import-data .wr-status").html(t.responseText)
  286.                                 } else {
  287.                                     f("#wr-install-sample-data-import-data .wr-status").html(wr_nitro_admin.unknown_error)
  288.                                 }
  289.                             }
  290.                             return m()
  291.                         }
  292.                         var v = f.proxy(function() {
  293.                             f("#wr-install-sample-data-import-data .spinner").removeClass("spinner").addClass("dashicons dashicons-yes");
  294.                             f("#demos .uninstall-sample").addClass("hidden");
  295.                             f("#demos .install-sample").removeClass("hidden");
  296.                             f(this).addClass("hidden").parent().children(".uninstall-sample").removeClass("hidden");
  297.                             if (t.responseJSON.data && t.responseJSON.data.required_plugins) {
  298.                                 return n(s, t.responseJSON.data)
  299.                             }
  300.                             if (t.responseJSON.data && t.responseJSON.data.demo_assets) {
  301.                                 return q(s, t.responseJSON.data.demo_assets)
  302.                             }
  303.                             m(true)
  304.                         }, this);
  305.                         if (t.responseJSON.data && t.responseJSON.data.refresh_nonce) {
  306.                             window.wr_nitro_refresh = t.responseJSON.data.refresh_nonce;
  307.                             k(v)
  308.                         } else {
  309.                             v()
  310.                         }
  311.                     }, this)).attr("src", r)
  312.                 }, this),
  313.                 k = function(r) {
  314.                     f.ajax({
  315.                         url: wr_nitro_admin.refresh_nonce_url,
  316.                         dataType: "json",
  317.                         data: {
  318.                             nonce: wr_nitro_refresh
  319.                         },
  320.                         complete: function(s) {
  321.                             if (s.responseJSON && s.responseJSON.success) {
  322.                                 for (var t in s.responseJSON.data) {
  323.                                     wr_nitro_admin[t] = s.responseJSON.data[t]
  324.                                 }
  325.                             }
  326.                             if (typeof r == "function") {
  327.                                 r()
  328.                             }
  329.                         }
  330.                     })
  331.                 },
  332.                 n = function(t, s) {
  333.                     if (s.required_plugins.length) {
  334.                         var r = function(u) {
  335.                             u = u || 0;
  336.                             f("#wr-install-sample-data-required-plugins .install-status").text((u + 1) + "/" + s.required_plugins.length + ": " + s.required_plugins[u]);
  337.                             f("#wr-install-sample-data-required-plugins .progress-bar").css("width", Math.round((u / s.required_plugins.length) * 100) + "%");
  338.                             f("#wr-install-sample-data-required-plugins .percentage").text(Math.round((u / s.required_plugins.length) * 100));
  339.                             return f.ajax({
  340.                                 url: wr_nitro_admin.install_plugin_url,
  341.                                 type: "POST",
  342.                                 dataType: "json",
  343.                                 data: {
  344.                                     plugin: s.required_plugins[u],
  345.                                     nonce: wr_nitro_admin.install_plugin_nonce
  346.                                 },
  347.                                 complete: function(v) {
  348.                                     if (!v.responseJSON && (v.responseJSON = v.responseText.match(/\{"success":.+\}/))) {
  349.                                         v.responseJSON = f.parseJSON(v.responseJSON[0])
  350.                                     }
  351.                                     if (!v.responseJSON || !v.responseJSON.success) {
  352.                                         if (v.responseJSON && v.responseJSON.data) {
  353.                                             var y = v.responseText.match(/<div class="error">(.+)<\/div>/);
  354.                                             if (y) {
  355.                                                 y = y[1]
  356.                                             } else {
  357.                                                 y = v.responseJSON.data
  358.                                             }
  359.                                             if (y == "NONCE_EXPIRED") {
  360.                                                 var w = false,
  361.                                                     x = (new Date()).getTime(),
  362.                                                     z = function() {
  363.                                                         var A = document.getElementById("wp-auth-check-frame");
  364.                                                         if (!w) {
  365.                                                             if (A) {
  366.                                                                 w = true
  367.                                                             }
  368.                                                         } else {
  369.                                                             if (!A) {
  370.                                                                 return k(function() {
  371.                                                                     r(u)
  372.                                                                 })
  373.                                                             }
  374.                                                         }
  375.                                                         if ((new Date()).getTime() - x < (60 * 1000)) {
  376.                                                             setTimeout(z, 200)
  377.                                                         } else {
  378.                                                             f("#wr-install-sample-data-required-plugins .wr-status").removeClass("hidden");
  379.                                                             f("#wr-install-sample-data-required-plugins .wr-status").append('<span class="session-expired">' + (f("#wr-install-sample-data-required-plugins .wr-status").html() != "" ? "<br>" : "") + wr_nitro_admin.session_expired + ' <a href="' + wr_nitro_admin.login_link + '" target="_blank" rel="noopener noreferrer">' + wr_nitro_admin.login_again + "</a></span>");
  380.                                                             window.wr_nitro_refesh_nonces_interval = setInterval(function() {
  381.                                                                 k(function() {
  382.                                                                     r(u)
  383.                                                                 })
  384.                                                             }, 5000)
  385.                                                         }
  386.                                                     };
  387.                                                 if (!window.wr_nitro_refeshed_nonces) {
  388.                                                     k(function() {
  389.                                                         r(u)
  390.                                                     });
  391.                                                     window.wr_nitro_refeshed_nonces = true
  392.                                                 } else {
  393.                                                     z()
  394.                                                 }
  395.                                                 return
  396.                                             }
  397.                                         } else {
  398.                                             y = wr_nitro_admin.install_plugin_failed.replace("%s", s.required_plugins[u])
  399.                                         }
  400.                                         f("#wr-install-sample-data-required-plugins .wr-status").removeClass("hidden");
  401.                                         if (f("#wr-install-sample-data-required-plugins .wr-status").html() != "") {
  402.                                             f("#wr-install-sample-data-required-plugins .wr-status").append("<br>")
  403.                                         }
  404.                                         f("#wr-install-sample-data-required-plugins .wr-status").append(y)
  405.                                     } else {
  406.                                         if (window.wr_nitro_refesh_nonces_interval) {
  407.                                             f("#wr-install-sample-data-required-plugins .wr-status .session-expired").remove();
  408.                                             clearInterval(wr_nitro_refesh_nonces_interval)
  409.                                         }
  410.                                     }
  411.                                     if (u + 1 == s.required_plugins.length) {
  412.                                         f("#wr-install-sample-data-required-plugins .install-status").addClass("hidden");
  413.                                         f("#wr-install-sample-data-required-plugins .progress").addClass("hidden");
  414.                                         if (f("#wr-install-sample-data-required-plugins .wr-status").hasClass("hidden")) {
  415.                                             f("#wr-install-sample-data-required-plugins .spinner").removeClass("spinner").addClass("dashicons dashicons-yes");
  416.                                             if (s.demo_assets) {
  417.                                                 return q(t, s.demo_assets)
  418.                                             }
  419.                                             m(true)
  420.                                         } else {
  421.                                             f("#wr-install-sample-data-required-plugins .spinner").removeClass("spinner").addClass("dashicons dashicons-no-alt");
  422.                                             m()
  423.                                         }
  424.                                         return
  425.                                     }
  426.                                     switch (s.required_plugins[u]) {
  427.                                         case "js_composer":
  428.                                             f.ajax({
  429.                                                 url: ajaxurl.replace("admin-ajax.php", "index.php"),
  430.                                                 complete: function() {
  431.                                                     r(u + 1)
  432.                                                 }
  433.                                             });
  434.                                             break;
  435.                                         default:
  436.                                             r(u + 1);
  437.                                             break
  438.                                     }
  439.                                 }
  440.                             })
  441.                         };
  442.                         f("#wr-install-sample-data-required-plugins").removeClass("hidden");
  443.                         r()
  444.                     } else {
  445.                         if (s.demo_assets) {
  446.                             return q(t, s.demo_assets)
  447.                         }
  448.                         m(true)
  449.                     }
  450.                 },
  451.                 q = function(t, s) {
  452.                     var r = function(u) {
  453.                         u = u || 0;
  454.                         f("#wr-install-sample-data-demo-assets .download-status").text((u + 1) + "/" + s.length + ": " + s[u]);
  455.                         f("#wr-install-sample-data-demo-assets .progress-bar").css("width", Math.round((u / s.length) * 100) + "%");
  456.                         f("#wr-install-sample-data-demo-assets .percentage").text(Math.round((u / s.length) * 100));
  457.                         f.ajax({
  458.                             url: wr_nitro_admin.install_sample_url,
  459.                             data: {
  460.                                 "package": t,
  461.                                 step: 4,
  462.                                 asset: u,
  463.                                 nonce: wr_nitro_admin.install_sample_nonce
  464.                             },
  465.                             complete: function() {
  466.                                 if (u + 1 == s.length) {
  467.                                     f("#wr-install-sample-data-demo-assets .spinner").removeClass("spinner").addClass("dashicons dashicons-yes");
  468.                                     f("#wr-install-sample-data-demo-assets .download-status").addClass("hidden");
  469.                                     f("#wr-install-sample-data-demo-assets .progress").addClass("hidden");
  470.                                     return m(true)
  471.                                 }
  472.                                 r(u + 1)
  473.                             }
  474.                         })
  475.                     };
  476.                     f("#wr-install-sample-data-demo-assets").removeClass("hidden");
  477.                     r()
  478.                 },
  479.                 m = function(r) {
  480.                     f("#TB_closeWindowButton").removeAttr("data-prevent-close");
  481.                     if (r) {
  482.                         f("#wr-install-sample-data-success-message").removeClass("hidden")
  483.                     } else {
  484.                         f("#wr-install-sample-data-failure-message").removeClass("hidden")
  485.                     }
  486.                 };
  487.             switch (j) {
  488.                 case "install":
  489.                     f.ajax({
  490.                         context: this,
  491.                         url: wr_nitro_admin.install_sample_url,
  492.                         dataType: "json",
  493.                         data: {
  494.                             "package": f(this).attr("data-package"),
  495.                             nonce: wr_nitro_admin.install_sample_nonce
  496.                         },
  497.                         complete: function(r) {
  498.                             if (!r.responseJSON || !r.responseJSON.data) {
  499.                                 f("#TB_ajaxContent").append(r.responseText ? r.responseText : wr_nitro_admin.unknown_error)
  500.                             } else {
  501.                                 f("#TB_ajaxContent").append(r.responseJSON.data);
  502.                                 f("#TB_ajaxContent").on("click", '#sample-data-installation-options input[name="option"]', function(s) {
  503.                                     f("#sample-data-installation-options .select-page")[this.value == "full" ? "hide" : "show"]()
  504.                                 }).on("click", "#sample-data-installation-options .select-page .box", function(s) {
  505.                                     f(this).toggleClass("selected");
  506.                                     if (f(this).hasClass("selected")) {
  507.                                         f(this).children('input[type="checkbox"]').attr("checked", "checked")
  508.                                     } else {
  509.                                         f(this).children('input[type="checkbox"]').removeAttr("checked")
  510.                                     }
  511.                                 }).on("click", "#confirm-sample-data-installation", function(s) {
  512.                                     if (s.target.checked) {
  513.                                         f("#go-to-sample-data-installation-step-2").removeAttr("disabled")
  514.                                     } else {
  515.                                         f("#go-to-sample-data-installation-step-2").attr("disabled", "disabled")
  516.                                     }
  517.                                 }).on("click", "#cancel-sample-data-installation", function(s) {
  518.                                     f("#TB_closeWindowButton").trigger("click")
  519.                                 }).on("click", "#go-to-sample-data-installation-step-2", function(s) {
  520.                                     f("#sample-data-installation-step-1").addClass("hidden");
  521.                                     f("#sample-data-installation-step-2").removeClass("hidden");
  522.                                     p(f("#sample-data-installation-step-2").attr("data-package"))
  523.                                 })
  524.                             }
  525.                         }
  526.                     });
  527.                     break;
  528.                 case "uninstall":
  529.                     f.ajax({
  530.                         context: this,
  531.                         url: wr_nitro_admin.uninstall_sample_url,
  532.                         dataType: "json",
  533.                         data: {
  534.                             "package": f(this).attr("data-package"),
  535.                             nonce: wr_nitro_admin.uninstall_sample_nonce
  536.                         },
  537.                         complete: function(r) {
  538.                             if (!r.responseJSON || !r.responseJSON.data) {
  539.                                 f("#TB_ajaxContent").append(r.responseText ? r.responseText : wr_nitro_admin.unknown_error)
  540.                             } else {
  541.                                 f("#TB_ajaxContent").append(r.responseJSON.data);
  542.                                 f("#TB_ajaxContent").on("click", "#confirm-sample-data-uninstallation", function(s) {
  543.                                     if (s.target.checked) {
  544.                                         f("#go-to-sample-data-installation-step-2").removeAttr("disabled")
  545.                                     } else {
  546.                                         f("#go-to-sample-data-installation-step-2").attr("disabled", "disabled")
  547.                                     }
  548.                                 }).on("click", "#cancel-sample-data-installation", function(s) {
  549.                                     f("#TB_closeWindowButton").trigger("click")
  550.                                 }).on("click", "#go-to-sample-data-installation-step-2", f.proxy(function(s) {
  551.                                     f("#demos").find(".install-sample, .uninstall-sample").attr("disabled", "disabled");
  552.                                     f(this).addClass("hidden").after('<span class="spinner is-active"></span>');
  553.                                     f("#TB_closeWindowButton").trigger("click");
  554.                                     f("#nitro-manipulate-sample-data").off("load").load(f.proxy(function(u) {
  555.                                         var t = {
  556.                                             responseText: f(u.target).contents().find("body").text(),
  557.                                             responseJSON: f(u.target).contents().find("body").text().match(/\{"success":.+\}/)
  558.                                         };
  559.                                         if (t.responseJSON) {
  560.                                             t.responseJSON = f.parseJSON(t.responseJSON[0])
  561.                                         }
  562.                                         if (!t.responseJSON || !t.responseJSON.success) {
  563.                                             if (t.responseJSON && t.responseJSON.data) {
  564.                                                 alert(t.responseJSON.data)
  565.                                             } else {
  566.                                                 alert(t.responseText ? t.responseText : wr_nitro_admin.unknown_error)
  567.                                             }
  568.                                             f(this).removeClass("hidden").next().remove();
  569.                                             return f("#demos").find(".install-sample, .uninstall-sample").removeAttr("disabled")
  570.                                         }
  571.                                         window.location.reload()
  572.                                     }, this)).attr("src", wr_nitro_admin.uninstall_sample_url + "&step=2&package=" + f(this).attr("data-package") + "&nonce=" + wr_nitro_admin.uninstall_sample_nonce)
  573.                                 }, this))
  574.                             }
  575.                         }
  576.                     });
  577.                     break
  578.             }
  579.         })
  580.     }
  581.  
  582.     function a() {
  583.         if (typeof f.fn.magnificPopup == "undefined") {
  584.             return setTimeout(a, 100)
  585.         }
  586.         f(".open-purchase-code").magnificPopup({
  587.             type: "image",
  588.             mainClass: "mfp-fade",
  589.             removalDelay: 160
  590.         })
  591.     }
  592.     f(document).ready(function() {
  593.         e();
  594.         c();
  595.         d();
  596.         b();
  597.         g();
  598.         if (f(".open-purchase-code").length) {
  599.             a()
  600.         }
  601.     })
  602. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement