Advertisement
rdsedmundo

103T.js V0.5 - */13

Apr 20th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Attach(e, t) {
  2.     if (t.search(__PREFIX) == -1 && t.search("admin/") == -1) {
  3.         t = __PREFIX + arguments[1]
  4.     }
  5.     return $("#" + e).loading().load(t)
  6. }
  7. function fSubmit(object) {
  8.             object.id.search("Add") !== -1 ? prefix = "a_" : prefix = "e_";
  9.             if (eval("object." + prefix + "mat.value") == -1) {
  10.                 prefix == "a_" ? ShowBox("Add", 1) : ShowBox("Edit", 1);
  11.                 alert("Selecione uma matéria!");
  12.                 return false
  13.             }
  14.             prefix == "a_" ? url = __PREFIX + "addA.php?d=" + gToken() : url = __PREFIX + "edit.php?d=" + gToken() + "&step=2&NOTICE_ID=" + $("#e_id").val();
  15.             if (prefix == "a_") {
  16.                 stuff = function () {
  17.                     $.post(url, {
  18.                         a_til: $("#a_til").val(),
  19.                         a_cont: $("#a_cont").val(),
  20.                         a_mat: $("#a_mat").val(),
  21.                         a_data: $("#a_data").val()
  22.                     }, function (c) {
  23.                         eval(c)
  24.                     })
  25.                 };
  26.                 if (W.GCasync) {
  27.                     $.post("inc/other/google_calendar/Post.php", {
  28.                         t: $("#a_til").val(),
  29.                         c: $("#a_cont").val(),
  30.                         m: parseMat($("#a_mat").val()),
  31.                         d: $("#a_data").val()
  32.                     }, function (e) {
  33.                         k("G-Mail response: " + e, 1);
  34.                         if (e.search("Enviado")!==-1) stuff();
  35.                         else k("Ocorreu um erro no envio ao g-mail, tente novamente.")
  36.                     })
  37.                 } else {
  38.                     stuff()
  39.                 }
  40.             } else {
  41.                 $.post(url, {
  42.                     e_til: $("#e_til").val(),
  43.                     e_cont: $("#e_cont").val(),
  44.                     e_mat: $("#e_mat").val(),
  45.                     e_data: $("#e_data").val()
  46.                 }, function (c) {
  47.                     eval(c)
  48.                 })
  49.             }
  50. }
  51. function ValidForm(e) {
  52.     if (e.id.search("Add") !== -1) {
  53.         prefix = "a_"
  54.     } else {
  55.         prefix = "e_"
  56.     }
  57.     for (var t in [prefix + "til", prefix + "cont", prefix + "data", prefix + "mat"]) {
  58.         if (t == prefix + "mat" && isNaN($("#" + t).val())) {
  59.             return alert("Valor inválido para data")
  60.         }
  61.         if ($("#" + t).val() == "") {
  62.             return alert("Preencha todos os campos!")
  63.         }
  64.     }
  65.     fSubmit(e);
  66.     return true
  67. }
  68. function ShowBox() {
  69.     objName = arguments[0], eShake = arguments[1] || 0;
  70.     switch (objName) {
  71.     case "Add":
  72.         if (!loggedin) {
  73.             login();
  74.             return k("Você precisa estar autenticado para fazer isso.")
  75.         }
  76.         if (fbAuth) {
  77.             if ($("body").html().search("fb-root") == -1 || typeof W.fbName !== "string") {
  78.                 $.getScript("inc/js/FB.root.js?d=" + gToken())
  79.             }
  80.         }
  81.         $("#Add-A-Box").dialog({
  82.             width: "480px",
  83.             resizable: false,
  84.             modal: true,
  85.             buttons: [{
  86.                     text: "Adicionar atividade",
  87.                     click: function () {
  88.                         $("#Add-A-Box").next(".ui-dialog-buttonpane button:contains('Confirm')").attr("disabled", false);
  89.                         if (fbAuth) {
  90.                             iAdd = W.setInterval(function () {
  91.                                 if (location.hash.search("user=") !== -1) {
  92.                                     W.clearInterval(iAdd);
  93.                                     $("#Add-A-Form").submit()
  94.                                 }
  95.                             }, 100)
  96.                         } else {
  97.                             $("#Add-A-Form").submit()
  98.                         }
  99.                         $(".ui-dialog button:nth-child(1)").button("disable")
  100.                     }
  101.                 }
  102.             ]
  103.         }).each(function () {
  104.             if (eShake) {
  105.                 $(this).effect("shake", 3e3)
  106.             }
  107.         });
  108.         break;
  109.     case "Edit":
  110.         $("#e_id").val(location.href.split("?id=")[1]);
  111.         $.ajax(__PREFIX + "edit.php?d=" + gToken() + "&step=1&NOTICE_ID=" + location.href.split("?id=")[1], {
  112.             success: function (e) {
  113.                 if (e.match("INVALID")) {
  114.                     alert("Ocorreu um erro fatal.");
  115.                     location.reload()
  116.                 }
  117.                 var t = e.split("%%");
  118.                 $("#e_til").val(t[0]);
  119.                 $("#e_cont").val(t[1]);
  120.                 $("#e_mat").val(t[2]);
  121.                 $("#e-select").val(t[2]);
  122.                 $("#e_data").val(t[3]);
  123.                 $("#Edit-A-Box").dialog({
  124.                     width: "480px",
  125.                     resizable: false,
  126.                     modal: true,
  127.                     buttons: [{
  128.                             text: "Editar atividade",
  129.                             click: function () {
  130.                                 $("#Edit-A-Form").submit()
  131.                             }
  132.                         }, {
  133.                             text: "Restaurar formulário",
  134.                             click: function () {
  135.                                 $("#Edit-A-Form").each(function () {
  136.                                     $(this).reset()
  137.                                 })
  138.                             }
  139.                         }
  140.                     ]
  141.                 }).each(function () {
  142.                     if (eShake) {
  143.                         $(this).effect("shake", 3e3)
  144.                     }
  145.                 })
  146.             },
  147.             error: function () {
  148.                 alert("Ocorreu uma falha na autenticação com o Banco de Dados.\n\nO Script tentará, automaticamente, refazer o pedido em alguns segundos.");
  149.                 return setTimeout(function () {
  150.                     location.reload()
  151.                 }, 3e3)
  152.             }
  153.         });
  154.         break;
  155.     case "Del":
  156.         nID = location.href.split("?id=")[1];
  157.         $("#Del-A-Box").dialog({
  158.             width: "480px",
  159.             resizable: false,
  160.             modal: true,
  161.             buttons: [{
  162.                     text: "Prosseguir",
  163.                     click: function () {
  164.                         $.get(__PREFIX + "delete.php?d=" + gToken(), {
  165.                             i: nID
  166.                         }, function (D) {
  167.                             eval(D);
  168.                             $("#Del-A-Box").dialog("destroy")
  169.                         })
  170.                     }
  171.                 }
  172.             ]
  173.         });
  174.         break;
  175.     default:
  176.         break
  177.     }
  178. }
  179. function HideBox(e) {
  180.     switch (e) {
  181.     case "Add":
  182.         $("#Add-A-Box").dialog("destroy");
  183.         break;
  184.     case "Edit":
  185.         $("#Edit-A-Box").dialog("destroy");
  186.         break;
  187.     case "Del":
  188.         $("#Del-A-Box").dialog("destroy");
  189.         break;
  190.     case "Log":
  191.         $("#usr-login").dialog("destroy");
  192.         break;
  193.     case "Reg":
  194.         $("#usr-reg").dialog("destroy");
  195.         $("#usr-go-reg").dialog("destroy");
  196.         break;
  197.     case "All":
  198.         try {
  199.             $("#Add-A-Box").dialog("destroy")
  200.         } catch (t) {}
  201.         try {
  202.             $("#Edit-A-Box").dialog("destroy")
  203.         } catch (t) {}
  204.         try {
  205.             $("#Del-A-Box").dialog("destroy")
  206.         } catch (t) {}
  207.         try {
  208.             $("#usr-login").dialog("destroy")
  209.         } catch (t) {}
  210.         try {
  211.             $("#usr-reg").dialog("destroy")
  212.         } catch (t) {}
  213.         try {
  214.             $("#usr-go-reg").dialog("destroy")
  215.         } catch (t) {}
  216.         break
  217.     }
  218. }
  219. function reg() {
  220.     $("#usr-reg").dialog({
  221.         width: "480px",
  222.         resizable: false,
  223.         modal: true,
  224.         buttons: [{
  225.                 text: "Ciente, e desejo prosseguir com meu registro",
  226.                 click: function () {
  227.                     $("#usr-reg").dialog("destroy");
  228.                     $("#usr-go-reg").dialog({
  229.                         width: "480px",
  230.                         resizable: false,
  231.                         modal: true,
  232.                         buttons: [{
  233.                                 text: "Registrar",
  234.                                 click: function () {
  235.                                     $.get(__PREFIX + "register.php?token=" + gToken(), {
  236.                                         u: $("#r-name").val(),
  237.                                         p: $("#r-pass").val()
  238.                                     }, function (E) {
  239.                                         eval(E)
  240.                                     })
  241.                                 }
  242.                             }
  243.                         ]
  244.                     })
  245.                 }
  246.             }
  247.         ]
  248.     })
  249. }
  250. function login() {
  251.     $("#usr-login").dialog({
  252.         width: "240px",
  253.         resizable: false,
  254.         modal: true,
  255.         buttons: [{
  256.                 text: "Autenticar",
  257.                 click: function () {
  258.                     usr = $("#l-name").val(), passwd = $("#l-pass").val();
  259.                     if (usr == "" || passwd == "") {
  260.                         k("Preencha todos os campos!");
  261.                         return this
  262.                     }
  263.                     $.get(__PREFIX + "login.php?token=" + gToken(), {
  264.                         u: $("#l-name").val(),
  265.                         p: $("#l-pass").val()
  266.                     }, function (E) {
  267.                         eval(E);
  268.                         if (E.match("não existe")) {
  269.                             $("#usr-login").dialog("destroy")
  270.                         }
  271.                     })
  272.                 }
  273.             }, {
  274.                 text: "Criar uma conta",
  275.                 click: function () {
  276.                     HideBox("Log");
  277.                     reg()
  278.                 }
  279.             }
  280.         ]
  281.     })
  282. }
  283. function logout() {
  284.     $.cookie("user", "", {
  285.         expires: -3600,
  286.         path: "/"
  287.     });
  288.     $.cookie("pass", {
  289.         expires: -3600,
  290.         path: "/"
  291.     });
  292.     W.open("", "_self", "");
  293.     W.close();
  294.     window.W = undefined;
  295.     return false
  296. }
  297. function conc(Id) {
  298.     confirm("Você tem certeza?", function () {
  299.         i = parseInt(Id);
  300.         if (!isNaN(i)) {
  301.             $.get(__PREFIX + "conc_actv.php?token=" + gToken(), {
  302.                 nID: i
  303.             }, function (f) {
  304.                 eval(f)
  305.             })
  306.         }
  307.     })
  308. }
  309. function unconc(Id) {
  310.     confirm("Você tem certeza?", function () {
  311.         i = parseInt(Id);
  312.         if (!isNaN(i)) {
  313.             $.get(__PREFIX + "desfconc_actv.php?token=" + gToken(), {
  314.                 nID: i
  315.             }, function (f) {
  316.                 eval(f)
  317.             })
  318.         }
  319.     })
  320. }
  321. top.location != self.location ? top.location = self.location : null;
  322. $(function () {
  323.     if (navigator.userAgent.search("Chrome") == -1) alert("Para uma melhor exibição deste site, é recomendado usar o Google Chrome.", {
  324.             f: OPTIONS_SHOW_OR_NOT,
  325.             s: 0
  326.         });
  327.     setInterval(function () {
  328.         try {
  329.             $("label").each(function () {
  330.                 if ($(this).hasClass("select") == false && $(this).html().match(/option/gi)) $(this).addClass("select")
  331.             });
  332.             if (loggedin == true && typeof W == "object") {
  333.                 if ($.cookie("user") == null || $.cookie("user") == "" || $.cookie("pass") == null || $.cookie("pass") == "") {
  334.                     W.loggedin = false;
  335.                     alert("Sua sessão expirou.");
  336.                     dReload()
  337.                 }
  338.             }
  339.             $('input[type="submit"],input[type="button"],button').button().css("-webkit-appearance", "none").css("outline", "none");
  340.             $("input,textarea").css("outline", "none");
  341.             $('input[type="data"]').datepicker({
  342.                 yearRange: "2013:2013",
  343.                 monthNamesShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
  344.                 monthNames: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
  345.                 minDate: Tdate,
  346.                 maxDate: "02/12",
  347.                 gotoCurrent: true,
  348.                 dayNamesShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
  349.                 dayNamesMin: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
  350.                 dayNames: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
  351.                 dateFormat: "dd/mm",
  352.                 currentText: "Hoje"
  353.             });
  354.             $("#act-accordion").accordion({
  355.                 heightStyle: "content"
  356.             })
  357.         } catch (e) {}
  358.     }, 1);
  359.     $("#g-last").load(__PREFIX + "show_actv.php?d=" + gToken(), {}, function (e) {
  360.         $(this).html(e);
  361.         var t = ["fade", "fold", "pulsate", "slide"],
  362.             n = function () {
  363.                 return t[Math.floor(Math.random() * t.length)]
  364.             };
  365.         $("#gsite").tabs({
  366.             fx: {
  367.                 height: "toggle",
  368.                 opacity: "toggle"
  369.             }
  370.         }).show(n(), 1500, function () {
  371.             $("#copyright").show(n(), 3e3)
  372.         })
  373.     });
  374.     $("#l-forgot").click(function (e) {
  375.         var t = e,
  376.             n = e.timeStamp;
  377.         Attach("g-last", "forgot.php?from=" + n);
  378.         HideBox("Log");
  379.         return false
  380.     })
  381. });
  382. $.fn.loading = function () {
  383.     $(this).html("<div id='pbar_text'>Carregando (0%)...</div><br><br><div id='progressbar' style='width:600px'></div>");
  384.     return this
  385. };
  386. jQuery.fn.load = function (t, n, r) {
  387.     $("#progressbar").progressbar();
  388.     if (typeof t !== "string" && _load) {
  389.         return _load.apply(this, arguments)
  390.     }
  391.     var i, s, o, u = this,
  392.         a = t.indexOf(" ");
  393.     if (a >= 0) {
  394.         i = t.slice(a, t.length);
  395.         t = t.slice(0, a)
  396.     }
  397.     if (jQuery.isFunction(n)) {
  398.         r = n;
  399.         n = undefined
  400.     } else if (n && typeof n == "object") {
  401.         o = "POST"
  402.     }
  403.     if (u.length > 0) {
  404.         jQuery.ajax({
  405.             xhr: function () {
  406.                 var t = new W.XMLHttpRequest;
  407.                 t.upload.addEventListener("progress", function (t) {
  408.                     if (t.lengthComputable) {
  409.                         Percent = Math.round(100 * e.loaded / e.total);
  410.                         $("#progressbar").progressbar({
  411.                             value: Percent
  412.                         });
  413.                         $("#pbar_text").html(Percent + "%")
  414.                     }
  415.                 }, false);
  416.                 t.addEventListener("progress", function (e) {
  417.                     if (e.lengthComputable) {
  418.                         Percent = Math.round(100 * e.loaded / e.total);
  419.                         $("#progressbar").progressbar({
  420.                             value: Percent
  421.                         });
  422.                         $("#pbar_text").html(Percent + "%")
  423.                     }
  424.                 });
  425.                 return t
  426.             },
  427.             url: t,
  428.             type: o,
  429.             dataType: "html",
  430.             data: n
  431.         }).done(function (e) {
  432.             s = arguments;
  433.             u.html(i ? jQuery("<div>").append(jQuery.parseHTML(e)).find(i) : e)
  434.         }).complete(r && function (e, t) {
  435.             u.each(r, s || [e.responseText, t, e])
  436.         })
  437.     }
  438.     return this
  439. };
  440. $.fn.reset = function () {
  441.     $(this).each(function () {
  442.         this.reset()
  443.     });
  444.     return this
  445. };
  446. $.cookie = function (e, t, n) {
  447.     if (arguments.length > 1 && String(t) !== "[object Object]") {
  448.         n = jQuery.extend({}, n);
  449.         if (t == null || t == undefined) {
  450.             n.expires = -1
  451.         }
  452.         if (typeof n.expires == "number") {
  453.             var r = n.expires,
  454.                 i = n.expires = new Date;
  455.             i.setDate(i.getDate() + r)
  456.         }
  457.         t = String(t);
  458.         return document.cookie = [encodeURIComponent(e), "=", n.raw ? t : encodeURIComponent(t), n.expires ? "; expires=" + n.expires.toUTCString() : "", n.path ? "; path=" + n.path : "", n.domain ? "; domain=" + n.domain : "", n.secure ? "; secure" : ""].join("")
  459.     }
  460.     n = t || {};
  461.     var s, o = n.raw ? function (e) {
  462.             return e
  463.         } : decodeURIComponent;
  464.     return (s = (new RegExp("(?:^|; )" + encodeURIComponent(e) + "=([^;]*)")).exec(document.cookie)) ? o(s[1]) : null
  465. };
  466. $(W).keydown(function (e) {
  467.     if (e.ctrlKey && e.altKey) {
  468.         switch (e.keyCode) {
  469.         case 65:
  470.             Attach("g-last", "admin/rcon/index.php?s=" + prompt("Senha de acesso: ", ""));
  471.             break;
  472.         case 66:
  473.             dReload();
  474.             break
  475.         }
  476.     }
  477. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement