DemoNCS / Neo AST

// ==UserScript==
// @namespace     https://openuserjs.org/users/DemoNCS
// @name          Neo AST
// @description   It helps to make sure that you click orange ads by server time
// @updateURL     https://openuserjs.org/meta/DemoNCS/Neo_AST.meta.js
// @copyright     2017~2018, DemoNCS (https://openuserjs.org/users/DemoNCS)
// @license       MIT
// @version       1.2.2
// @match         https://www.neobux.com/m/v/*
// @grant none
// ==/UserScript==

// ==OpenUserJS==
// @author DemoNCS
// ==/OpenUserJS==

// Update 1.0.0 > 1.1.1
// 1) If Userbar is pinned Neo AST will also be pinned.
// 2) The usual "Please Wait" information will receive additional information, for which hour you have to wait.(Depends on the click hour option selected and the user's local time)
// 3) Minor text changes for all languages, see point 2.
// Update 1.1.1 > 1.1.2 > 1.1.3 > 1.1.4 > 1.1.5 > 1.1.6
// A small amendment to the changes that occurred in NeoBux
// Update 1.1.5.1 > 1.1.7 (CSS Fix)
// Update 1.2.0 (JS,CSS Fix)
// Update 1.2.1 (JS Fix)
// Update 1.2.2 (JS Add Fixed AD Icon Info loader)

$(window).ready(function () {
  var AST = {
    Translate: function () {
      var txt, l = $($(".c0")[0]).attr("class").split('f-')[1];
      switch (l) {
        case 'us': // English
        default:
          txt = {
            Local_Time: 'New server day for your local time.',
            Ads_Help_Info: 'Click on Fixed Orange Advertisements before {0}.<br />But not earlier than after {1}.',
            Protect_Info: 'Please Wait\\a to {0}',
            Pop_op_Title: 'AST Options',
            Pop_op_Option_Desc: 'Select options when you want to click Fixed Orange Advertisements.',
            Pop_op_Option_1: 'Option 1:',
            Pop_op_Option_2: 'Option 2:',
            Pop_op_Time_Desc: 'Select time display options.',
            Pop_op_Time_1: '12-hour clock',
            Pop_op_Time_2: '24-hour clock',
            Pop_op_Protect_Desc: 'Choose whether you want to secure Fixed Orange Advertisements at a time when you should not click them.',
            Pop_op_Protect_1: 'Dont protect',
            Pop_op_Protect_2: 'Yes, protect',
            Pop_Option_1: 'You chosen Option 1',
            Pop_Option_2: 'You chosen Option 2',
            Pop_Time_1: 'Change to a 12-hour clock',
            Pop_Time_2: 'Change to a 24-hour clock',
            Pop_Protect_1: 'Disabling protection',
            Pop_Protect_2: 'Enabling protection'
          };
          break;
        case 'pt': // Portuguese
          txt = {
            Local_Time: 'Novo dia de servidor para sua hora local.',
            Ads_Help_Info: 'Clique em laranja Anúncios fixos antes das {0}.<br />Mas não mais cedo depois das {1}.',
            Protect_Info: 'Por favor espere\\a até às {0}',
            Pop_op_Title: 'AST Opções',
            Pop_op_Option_Desc: 'Selecione as opções quando deseja clicar em Anúncios fixos da laranja.',
            Pop_op_Option_1: 'Opção 1:',
            Pop_op_Option_2: 'Opção 2:',
            Pop_op_Time_Desc: 'Selecione as opções de exibição do tempo.',
            Pop_op_Time_1: 'Relógio de 12 horas',
            Pop_op_Time_2: 'Relógio de 24 horas',
            Pop_op_Protect_Desc: 'Escolha se deseja proteger os anúncios de laranja fixos quando não deve clicar neles.',
            Pop_op_Protect_1: 'Não proteja',
            Pop_op_Protect_2: 'Sim, proteja',
            Pop_Option_1: 'Você escolheu a Opção 1',
            Pop_Option_2: 'Você escolheu a Opção 2',
            Pop_Time_1: 'Mude para um relógio de 12 horas',
            Pop_Time_2: 'Mude para um relógio de 24 horas',
            Pop_Protect_1: 'Proteção incapacitante',
            Pop_Protect_2: 'Proteção habilitadora'
          };
          break;
        case 'es': // Spanish
          txt = {
            Local_Time: 'Nuevo día de servidor para su hora local.',
            Ads_Help_Info: 'Haga clic en anuncios fijos naranja antes de {0}.<br />Pero no antes de las {1}.',
            Protect_Info: 'Por favor espere\\a a las {0}',
            Pop_op_Title: 'AST Opciones',
            Pop_op_Option_Desc: 'Seleccione las opciones cuando desee hacer clic en Anuncios Naranja Fijos.',
            Pop_op_Option_1: 'Opción 1:',
            Pop_op_Option_2: 'Opción 2:',
            Pop_op_Time_Desc: 'Seleccione las opciones de visualización de la hora.',
            Pop_op_Time_1: 'Reloj de 12 horas',
            Pop_op_Time_2: 'Reloj de 24 horas',
            Pop_op_Protect_Desc: 'Elija si desea asegurar Anuncios Naranja Fijos en un momento en que no debe hacer clic en ellos.',
            Pop_op_Protect_1: 'No proteger',
            Pop_op_Protect_2: 'Sí, proteger',
            Pop_Option_1: 'Has elegido la Opción 1',
            Pop_Option_2: 'Has elegido la Opción 2',
            Pop_Time_1: 'Cambiar a un reloj de 12 horas',
            Pop_Time_2: 'Cambiar a un reloj de 24 horas',
            Pop_Protect_1: 'Deshabilitar la protección',
            Pop_Protect_2: 'Habilitar la protección'
          };
          break;
        case 'gr': // Greek
          txt = {
            Local_Time: 'Νέα ημέρα διακομιστή για την τοπική σας ώρα.',
            Ads_Help_Info: 'Κάντε κλικ στις πορτοκαλί σταθερές διαφημίσεις πριν από τις {0}.<br />Αλλά όχι νωρίτερα μετά τις {1}.',
            Protect_Info: 'Παρακαλώ περιμένετε\\aέως {0}',
            Pop_op_Title: 'AST Επιλογές',
            Pop_op_Option_Desc: 'Επιλέξτε επιλογές όταν θέλετε να κάνετε κλικ στην επιλογή Διαφημίσεις σταθερού πορτοκαλί.',
            Pop_op_Option_1: 'Επιλογή 1:',
            Pop_op_Option_2: 'Επιλογή 2:',
            Pop_op_Time_Desc: 'Επιλέξτε επιλογές εμφάνισης ώρας.',
            Pop_op_Time_1: 'Ρολόι 12 ωρών',
            Pop_op_Time_2: 'Ρολόι 24 ωρών',
            Pop_op_Protect_Desc: 'Επιλέξτε αν θέλετε να διασφαλίσετε διαφημίσεις σταθερού πορτοκαλί σε μια στιγμή που δεν πρέπει να κάνετε κλικ σε αυτές.',
            Pop_op_Protect_1: 'Μην προστασία',
            Pop_op_Protect_2: 'Ναι, προστατεύστε',
            Pop_Option_1: 'Επιλέξατε την επιλογή 1',
            Pop_Option_2: 'Επιλέξατε την επιλογή 2',
            Pop_Time_1: 'Αλλάξτε σε ρολόι 12 ωρών',
            Pop_Time_2: 'Αλλάξτε σε ρολόι 24 ωρών',
            Pop_Protect_1: 'Απενεργοποίηση προστασίας',
            Pop_Protect_2: 'Ενεργοποίηση της προστασίας'
          };
          break;
        case 'id': // Indonesian
          txt = {
            Local_Time: 'Hari server baru untuk waktu lokal Anda.',
            Ads_Help_Info: 'Klik pada Iklan Fixed oranye sebelum {0}.<br />Tapi tidak lebih cepat setelah jam {1}.',
            Protect_Info: 'Mohon tunggu\\a untuk {0}',
            Pop_op_Title: 'AST Pilihan',
            Pop_op_Option_Desc: 'Pilih opsi bila Anda ingin mengeklik Iklan Orange Tetap.',
            Pop_op_Option_1: 'Opsi 1:',
            Pop_op_Option_2: 'Opsi 2:',
            Pop_op_Time_Desc: 'Pilih opsi tampilan waktu.',
            Pop_op_Time_1: '12-jam',
            Pop_op_Time_2: '24-jam',
            Pop_op_Protect_Desc: 'Pilih apakah Anda ingin mengamankan Tetap Jeruk Iklan pada saat Anda tidak harus mengklik mereka.',
            Pop_op_Protect_1: 'Jangan melindungi',
            Pop_op_Protect_2: 'Ya, melindungi',
            Pop_Option_1: 'Anda memilih Opsi 1',
            Pop_Option_2: 'Anda memilih Opsi 2',
            Pop_Time_1: 'Ubah ke 12 jam',
            Pop_Time_2: 'Ubah ke 24 jam',
            Pop_Protect_1: 'Menonaktifkan perlindungan',
            Pop_Protect_2: 'Mengaktifkan perlindungan'
          };
          break;
        case 'fi': // Finnish
          txt = {
            Local_Time: 'Uusi palvelinpäivä paikalliseen aikaan.',
            Ads_Help_Info: 'Napsauta oransseja Kiinteät ilmoitukset ennen {0}.<br />Kuitenkin aikaisintaan jälkeen {1}.',
            Protect_Info: 'Odota kiinni\\a {0}',
            Pop_op_Title: 'AST Vaihtoehdot',
            Pop_op_Option_Desc: 'Valitse vaihtoehtoja, kun haluat napsauttaa Kiinteitä oransseja mainoksia.',
            Pop_op_Option_1: 'Vaihtoehto 1:',
            Pop_op_Option_2: 'Vaihtoehto 2:',
            Pop_op_Time_Desc: 'Valitse ajan näyttöasetukset.',
            Pop_op_Time_1: '12 tunnin kello',
            Pop_op_Time_2: '24 tunnin kello',
            Pop_op_Protect_Desc: 'Valitse, haluatko suojata kiinteät oranssit mainokset samaan aikaan, jolloin niitä ei pitäisi napsauttaa.',
            Pop_op_Protect_1: 'Eivät suojaa',
            Pop_op_Protect_2: 'Kyllä, suojella',
            Pop_Option_1: 'Valitsit vaihtoehdon 1',
            Pop_Option_2: 'Valitsit vaihtoehdon 2',
            Pop_Time_1: 'Vaihda 12 tunnin kelloon',
            Pop_Time_2: 'Vaihda 24 tunnin kelloon',
            Pop_Protect_1: 'Suojauksen poistaminen käytöstä',
            Pop_Protect_2: 'Suojauksen ottaminen käyttöön'
          };
          break;
        case 'se': // Swedish
          txt = {
            Local_Time: 'Ny server dag för din lokala tid.',
            Ads_Help_Info: 'Klicka på orange fasta annonser före {0}.<br />Men inte tidigare än efter {1}.',
            Protect_Info: 'Vänta tills\\a {0}',
            Pop_op_Title: 'AST-alternativ',
            Pop_op_Option_Desc: 'Välj alternativ när du vill klicka på orange fasta annonser.',
            Pop_op_Option_1: 'Alternativ 1:',
            Pop_op_Option_2: 'Alternativ 2:',
            Pop_op_Time_Desc: 'Välj tidsvisningsalternativ.',
            Pop_op_Time_1: '12-timmars klocka',
            Pop_op_Time_2: '24-timmars klocka',
            Pop_op_Protect_Desc: 'Välj om du vill säkra orange fast annons annonser vid en tidpunkt då du inte ska klicka på dem.',
            Pop_op_Protect_1: 'Skydda inte',
            Pop_op_Protect_2: 'Ja, skydda',
            Pop_Option_1: 'Du valde Alternativ 1',
            Pop_Option_2: 'Du valde Alternativ 2',
            Pop_Time_1: 'Byt till en 12-timmars klocka',
            Pop_Time_2: 'Byt till en 24-timmars klocka',
            Pop_Protect_1: 'Inaktiverar skydd',
            Pop_Protect_2: 'Möjliggör skydd'
          };
          break;
        case 'de': // German
          txt = {
            Local_Time: 'Neuer Servertag für Ihre lokale Zeit.',
            Ads_Help_Info: 'Klicken Sie auf orange feste Anzeigen vor {0}.<br />Aber nicht früher als nach {1} Uhr.',
            Protect_Info: 'Bitte warten Sie\\a zu {0} Uhr',
            Pop_op_Title: 'AST Optionen',
            Pop_op_Option_Desc: 'Wählen Sie Optionen, wenn Sie auf feste orangefarbene Werbung klicken möchten.',
            Pop_op_Option_1: 'Option 1:',
            Pop_op_Option_2: 'Option 2:',
            Pop_op_Time_Desc: 'Wählen Sie die Zeitanzeigeoptionen aus.',
            Pop_op_Time_1: '12-Stunden-Uhr',
            Pop_op_Time_2: '24-Stunden-Uhr',
            Pop_op_Protect_Desc: 'Wählen Sie, ob Sie feste orangefarbene Werbung zu einem Zeitpunkt sichern möchten, zu dem Sie sie nicht anklicken sollten.',
            Pop_op_Protect_1: 'Nicht schützen',
            Pop_op_Protect_2: 'Ja, beschütze',
            Pop_Option_1: 'Sie haben die Option 1 gewählt',
            Pop_Option_2: 'Sie haben die Option 2 gewählt',
            Pop_Time_1: 'Wechseln Sie zu einer 12-Stunden-Uhr',
            Pop_Time_2: 'Wechseln Sie zu einer 24-Stunden-Uhr',
            Pop_Protect_1: 'Schutz deaktivieren',
            Pop_Protect_2: 'Schutz aktivieren'
          };
          break;
        case 'fr': // French
          txt = {
            Local_Time: 'Nouveau jour de serveur pour votre heure locale.',
            Ads_Help_Info: 'Cliquez sur les publicités fixes orange avant {0}.<br />Mais pas plus tôt que après {1}.',
            Protect_Info: 'S\'il vous plaît attendez\\a à {0}',
            Pop_op_Title: 'AST Options',
            Pop_op_Option_Desc: 'Sélectionnez les options lorsque vous voulez cliquer sur orange Publicités fixes',
            Pop_op_Option_1: 'Option 1:',
            Pop_op_Option_2: 'Option 2:',
            Pop_op_Time_Desc: 'Sélectionnez les options d\'affichage de l\'heure.',
            Pop_op_Time_1: 'Horloge 12 heures',
            Pop_op_Time_2: 'Horloge 24 heures',
            Pop_op_Protect_Desc: 'Choisissez si vous souhaitez sécuriser les publicités en orange fixe à un moment où vous ne devez pas cliquer dessus.',
            Pop_op_Protect_1: 'Ne pas protéger',
            Pop_op_Protect_2: 'Oui, protégez',
            Pop_Option_1: 'Vous avez choisi l\'option 1',
            Pop_Option_2: 'Vous avez choisi l\'option 2',
            Pop_Time_1: 'Passer à une horloge de 12 heures',
            Pop_Time_2: 'Passer à une horloge de 24 heures',
            Pop_Protect_1: 'Désactiver la protection',
            Pop_Protect_2: 'Activation de la protection'
          };
      }
      return txt;
    },
    Style: function () {
      var StyleCss = '#ast_info,#ast_rinfo {display: inline-block;width: 16px;height: 16px;background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAK4SURBVHjapJJNb1tVEIafc+65dvwRO7EdJ0EJSsKuH9QCSrbdkf4BkMoSCUXqBrHlPyCEVFEVdddWgl/Qsu6mLYUtoJZaSQUJsRN/XF/fe+65Z1iEOtkzm9FoNI9m5n2ViPB/wgC8/+HPp5XSuExtBIH+rNUKP6rXzDrAcOT2e73sUZ77uyaULuIBeP70g1PAm8gy/+nG26VvtrdrrZWVAko5AMSblYNDe/XJk9Fud2/6RWi4/2ZGnyaPc/mNSxfm7l3fqbdarYBpPOHKu47tqwbnUppNzfWdeuvShdI95/Ib4M8AeZ6ur66qW51OmXFk6fUTUjvlyuU2Fy8uEQQZvV7COLJ0OiVWV9WtPE/XZz9QKtvd2pxfmEQpmRMUEI0U3999SaVi6HYFL0IcQ2gUW5uFhcPDaBf4SgNUyn4nMJ7BcMpkkjIYJhwPRryzZVhfm+N4EDGc9aYExlMp+53ZBl7s2tHRmMx6JhPHySCjsei4dq1DoVDkuzsv6L5KaTQKVCqGsKARsWszwHQa88dvMV4E8eCcsFDTZJknDD0+t4xHEWmqUQq0Uog65wPIXnut2gAqABBEnzOYzsHkKCP/aQZK5PUZwNuHean4nquUQYTMgZ0/m7fVIumCg6IGpTCTGDO1D8/5wN7WLhlklSLxcpN4aRHbmKdoFEopskaNuN0gXm6SVYpolwzA3p4BPLKvrL1Z6B3jg4C03WS/2OSXvQndfybsmRppu4UPAgr9Y5S1Nz2yPzuhWv4JkdKDQrKcmxcnX4crm29FzSU+uXPAnFH0+zGL/R7Vg1d/zWV/fmnKBz8olQCfnwJC8zfgwzDsPktD/y3D+sf1k/FGLr6WAHWlR17bri79/mMpfP5MkYegs9kGIgYQEbQP1dHjsPTy15xqLfBSBRBNZBgPw6QXI0aEYCbRvwMAZStNZ39/9ZoAAAAASUVORK5CYII=) no-repeat center center;-moz-opacity: 0.6;-khtml-opacity: 0.6;opacity: 0.6;float: right;margin:6px 5px 0px 0px;-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;}#ast_rinfo {position: absolute;background-image: none;left: 0;right: 0;width: 100%;}#ast_info:hover {-moz-opacity: 0.8;-khtml-opacity: 0.8;opacity:0.8;cursor:help;}#ltn { color:#fff;font-size:14px;cursor:help; }#ast_op {background-color: rgba(0,0,0,.9);width: 486px;position: absolute;top: 62px;margin: 0px auto;left: 0px;right: 0px;z-index: 999999999;border-radius: 5px;-moz-box-shadow: 0px 0px 15px rgba(0,0,0,.7);-webkit-box-shadow: 0px 0px 15px rgba(0,0,0,.7);box-shadow: 0px 0px 15px rgba(0,0,0,.7);color: rgba(255,255,255,.9);text-align: left;overflow: hidden;display:none;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}#ast_op:hover {background-color:#000;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}#ast_opc {display: table;}#ast_cop {float: right;display: inline-block;position: relative;cursor: pointer;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}#ast_cop:hover {color: #0ff;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}#ast_cop:before {content: "\\00a0x\\00a0";}.ast_t {background-image: url(https://www.neobux.com/imagens/n/pagebanner_topo.png);background-size: cover;padding: 5px 5px 5px 10px;-moz-opacity: 0.9;-khtml-opacity: 0.9;opacity: 0.9;color: snow;font-weight: bold;text-shadow: 0px 0px 1px rgba(0,0,0,.5);cursor: default;-moz-user-select:none;-webkit-user-select:none;-khtml-user-select:none;user-select:none;}.ast_o {margin: 10px;}.ast_o > p {margin-bottom: 2px;margin-top: 4px;}.ast_o > p:not(:first-child) {border-top: 1px solid #333;}.opc {text-align: center;text-shadow: 0px 0px 1px rgba(0,0,0,.6);}.op {display: inline-block;padding: 5px;background-color: grey;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;margin: 5px;cursor: pointer;min-width: 84px;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}.op.select {background-color: #00ac00;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}.op:hover {background-color: #0080bf;-webkit-transition:all 500ms ease;-moz-transition:all 500ms ease;-o-transition:all 500ms ease;transition:all 500ms ease;}#ast_cp {position: fixed;text-align: center;width:100%;bottom:10px;z-index: 999999;}#p {width:300px;position: absolute;margin: 5px auto 5px auto;background-color: black;color:snow;line-height: 30px;padding: 5px;border-radius: 5px;bottom: 20px;left: 0px;right: 0px;cursor: default;-moz-user-select:none;-webkit-user-select:none;-khtml-user-select:none;user-select:none;}#p:empty {display:none;}';
      $("head #ast_css").prepend(StyleCss);
    },
    strFormat: function () {
      var args = Array.prototype.slice.call(arguments, 1);
      return arguments[0].replace(/\{(\d+)\}/g, function (match, index) {
        return args[index];
      });
    },
    Mark_objects: function () {
      $('.mbx[id*="sIn"] > div:nth-child(1)').attr("id", "ast");
      $('.mbx[id*="sIn"] > div:nth-child(2)').attr("id", "st");
      $("#ast span").attr("id", "ltr").attr("data-time", $("#ast span").text());
      $("#st span").attr("id", "stt");
      $($("#dCfd1 > div")[0]).addClass("astc");
      AST.Create_objects();
    },
    Create_objects: function () {
      $("head").append('<style id="ast_css"></style>');
      $("head").append('<style id="ast_css_f"></style>');
      $("head").append('<style id="ast_css_pfa"></style>');
      $("#ast").append(' ~ <span id="ltn"></span>');
      $("#stt").html($("#stt").text().split(' ')[0] + ' <span id="astt" data-time="' + $("#stt").text().split(' ')[1] + '">' + $("#stt").text().split(' ')[1] + '</span>');
      $(".astc").prepend('<div id="ast_op" style="display:none;"></div>');
      $("body").append("<script>mk_tt('ltn','rm','" + Lang.Local_Time + "');</script>");
      $("body").append('<div id="ast_cp" style="display:none;"><div id="p"></div></div>');
      AST.TL_info_loader();
      AST.Complete_objects();

      AST.Options_abbreviation();
    },
    TL_info_loader: function () {
      if( $('a#ad_fo + div > div > div[class*="grad"]').length ){
        $('a#ad_fo + div > div > div[class*="grad"]').attr("id", "astad_fo");
        $("#astad_fo").append('<span id="ast_info"></span>');
        AST.Rscript();
      } else {
        setTimeout(AST.TL_info_loader,500);
      }
    },
    Complete_objects: function () {
      switch (AST.getCookie('ASTClock')) {
        case '1':
          $("#ltn").text(AST.Server_Time().user_nd12).attr("data-time", AST.Server_Time().user_nd);
          break;
        default:
          $("#ltn").text(AST.Server_Time().user_nd).attr("data-time", AST.Server_Time().user_nd);
      }
      AST.LangCSS();
    },
    LangCSS: function () {
      var l = $($(".c0")[0]).attr("class").split('f-')[1];
      switch (l) {
        case 'us':
          break;
        case 'pt':
          break;
        case 'es':
          break;
        case 'gr':
          $("head #ast_css_f").text('.o3 {min-width: 117px;}');
          break;
        case 'id':
          $("head #ast_css_f").text('.o3 {min-width: 117px;}');
          break;
        case 'fi':
          break;
        case 'se':
          break;
        case 'de':
          if (AST.getCookie('ASTClock') == 1) {
            $("#ast, #st").css({
              "font-size": "13px",
              "line-height": "18px"
            });
            $("#ltr, #ltn, #stt").css({
              "font-size": "12px",
              "line-height": "18px"
            });
          }
          else {
            $("#ast, #st").css({
              "font-size": "14px"
            });
            $("#ltr, #ltn, #stt").css({
              "font-size": "13px"
            });
          }
          break;
        case 'fr':
          $("head #ast_css_f").text('.o3 {min-width: 117px;}');
      }
    },
    Server_Offset: function () {
      var sh, uh = new Date().getUTCHours();
      if (AST.getCookie('ASTClock') == 1) {
        sh = parseInt($("#astt").attr("data-time").split(':')[0]);
      }
      else {
        sh = parseInt($("#astt").text().split(':')[0]);
      }
      var so = (uh - sh);
      so = (so < 0) ? (so + 24) * 60 : so * 60;
      so = (so < 240 ? 240 : (so > 300 ? 300 : so));
      return so;
    },
    Server_Time: function () {
      var ur, un, uh, um, un12, ur12, srh, srm, oh, om, m, ro, shr = 0,
        smr = 0;
      var so = AST.Server_Offset();
      var uo = new Date().getTimezoneOffset();
      if (AST.getCookie('ASTClock') == 1) {
        ur = $("#ltr").attr("data-time").split(':');
      }
      else {
        ur = $("#ltr").text().split(':');
      }
      var urh = parseInt(ur[0]),
        urm = parseInt(ur[1]);
      (!(Number.isInteger(urh)) ? urh = 0 : urh);
      (!(Number.isInteger(urm)) ? urm = 0 : urm);
      if (uo >= 0) {
        ro = (so - uo);
      }
      if (uo < 0) {
        uo = Math.abs(uo);
        ro = (so + uo);
      }
      if (ro < 0) {
        ro = Math.abs(ro);
        m = true;
      }
      oh = Math.floor(ro / 60);
      om = (ro % 60);
      if (m) {
        um = (smr - om);
        uh = (shr - oh);
        srm = (urm + om);
        srh = (urh + oh);
        if (um < 0) {
          um = (um + 60);
          uh = (uh - 1);
        }
        if (uh < 0) {
          uh = (uh + 24);
        }
        if (srm >= 60) {
          srm = (srm - 60);
          srh = (srh + 1);
        }
        if (srm < 0) {
          srm = (srm + 60);
          srh = (srh - 1);
        }
        if (srh >= 24) {
          srh = (srh - 24);
        }
      }
      else {
        um = (smr + om);
        uh = (shr + oh);
        srm = (urm - om);
        srh = (urh - oh);
        if (uh >= 24) {
          uh = (uh - 24);
        }
        if (srm >= 60) {
          srm = (srm - 60);
          srh = (srh + 1);
        }
        if (srm < 0) {
          srm = (srm + 60);
          srh = (srh - 1);
        }
        if (srh < 0) {
          srh = (srh + 24);
        }
      }
      un = ('00' + uh).slice(-2) + ':' + ('00' + um).slice(-2);
      un12 = AST.T12h(un);
      ur = ('00' + urh).slice(-2) + ':' + ('00' + urm).slice(-2);
      ur12 = AST.T12h(ur);
      return {
        server_nd_h: shr,
        server_nd_m: smr,
        user_nd_h: uh,
        user_nd_m: um,
        user_nd: un,
        user_nd12: un12,
        server_ra_h: srh,
        server_ra_m: srm,
        user_ra_h: urh,
        user_ra_m: urm,
        user_ra: ur,
        user_ra12: ur12
      };
    },
    Protect_Option: function () {
      var ad_pf = false;
      switch (AST.getCookie('ASTProtect')) {
        case '1':
          break;
        default:
          var st, sh, sm, sndh, sndm, sarh, sarm, arhc, armc, ndhc, ndmc;

          sndh = AST.Server_Time().server_nd_h;
          sndm = AST.Server_Time().server_nd_m;
          sarh = AST.Server_Time().server_ra_h;
          sarm = AST.Server_Time().server_ra_m;

          switch (AST.getCookie('ASTClock')) {
            case '1':
              st = $("#astt").attr("data-time").split(':');
              break;
            default:
              st = $("#astt").text().split(':');
          }
          sh = parseInt(st[0]);
          sm = parseInt(st[1]);
          arhc = sarh;
          armc = (sarm - 1);
          if (armc < 0) {
            armc = armc + 60;
            arhc = arhc - 1;
          }
          if (arhc < 0) {
            arhc = arhc + 24;
          }
          ndhc = sndh;
          ndmc = (sndm - 1);
          if (ndmc < 0) {
            ndmc = ndmc + 60;
            ndhc = ndhc - 1;
          }
          if (ndhc < 0) {
            ndhc = ndhc + 24;
          }
          switch (AST.getCookie('ASTOption')) {
            case '1':
              if (sh >= sndh && sh <= arhc) {
                ad_pf = true;
                if ((sm <= armc) || ((sh < arhc) && (sm <= armc || sm >= armc))) {
                  ad_pf = true;
                }
                else {
                  ad_pf = false;
                }
              }
              break;
            default:
              if (sh >= sarh && sh <= ndhc) {
                ad_pf = true;
                if ((sm >= sarm) || ((sh > sarh) && (sm <= sarm || sm >= sarm))) {
                  ad_pf = true;
                }
                else {
                  ad_pf = false;
                }
              }
          }
          AST.CSS_fo(ad_pf);
      }
      AST.CSS_fo(ad_pf);
    },
    CSS_fo: function (ad_pf = false) {
      if (ad_pf) {
        var A_fo = 'div.mbx > a#ad_fo + div > div:nth-child(2) > div:before {z-index:999;background-color: rgba(255, 255, 255, 0.7);content: "' + AST.strFormat(Lang.Protect_Info, (AST.getCookie('ASTOption') == 1 ? (AST.getCookie('ASTClock') == 1 ? AST.Server_Time().user_ra12 : AST.Server_Time().user_ra) : (AST.getCookie('ASTClock') == 1 ? AST.Server_Time().user_nd12 : AST.Server_Time().user_nd))) + '";display: block;position: absolute;width: 100%;height: 100%;margin: -1px 0px 0px -1px;cursor: wait;cursor: not-allowed;font-weight: bold;text-align: center;line-height: 22px;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;white-space: pre;text-shadow: 1px 1px 1px #fff;}';
        $("#ast_css_pfa").text(A_fo);
      }
      else {
        $("#ast_css_pfa").empty();
      }

    },
    Options_Clicks: function () {
      var arh = AST.Server_Time().user_ra_h;
      var arm = AST.Server_Time().user_ra_m;
      var ndh = AST.Server_Time().user_nd_h;
      var ndm = AST.Server_Time().user_nd_m;

      var arhc, armc, ndhc, ndmc;
      arhc = arh;
      armc = (arm - 1);
      if (armc < 0) {
        armc = armc + 60;
        arhc = arhc - 1;
      }
      if (arhc < 0) {
        arhc = arhc + 24;
      }
      ndhc = ndh;
      ndmc = (ndm - 1);
      if (ndmc < 0) {
        ndmc = ndmc + 60;
        ndhc = ndhc - 1;
      }
      if (ndhc < 0) {
        ndhc = ndhc + 24;
      }

      tr0 = ('00' + arh).slice(-2) + ':' + ('00' + arm).slice(-2);
      tr1 = ('00' + arhc).slice(-2) + ':' + ('00' + armc).slice(-2);
      tn0 = ('00' + ndh).slice(-2) + ':' + ('00' + ndm).slice(-2);
      tn1 = ('00' + ndhc).slice(-2) + ':' + ('00' + ndmc).slice(-2);

      if (AST.getCookie('ASTOption') == 1) {
        $("#op1").toggleClass("select");
        $("#op2").toggleClass("select");
      }
      $("#op1").on("click", function () {
        if (!$("#op1").hasClass("select")) {
          $("#op1").toggleClass("select");
          $("#op2").toggleClass("select");
          AST.setCookie('ASTOption', 1);
          AST.Protect_Option();
          AST.Rscript();
        }
      });
      $("#op2").on("click", function () {
        if (!$("#op2").hasClass("select")) {
          $("#op2").toggleClass("select");
          $("#op1").toggleClass("select");
          AST.deleteCookie('ASTOption');
          AST.Protect_Option();
          AST.Rscript();
        }
      });

      switch (AST.getCookie('ASTClock')) {
        case '1':
          return {
            option1: AST.T12h(tr0) + ' «» ' + AST.T12h(tn1),
            option2: AST.T12h(tn0) + ' «» ' + AST.T12h(tr1)
          };
          break;
        default:
          return {
            option1: tr0 + ' «» ' + tn1,
            option2: tn0 + ' «» ' + tr1
          };
      }
    },
    Select_Time: function () {
      if (AST.getCookie('ASTClock') == 1) {
        $("#clock12").toggleClass("select");
        $("#clock24").toggleClass("select");
      }
      $("#clock12").on("click", function () {
        if (!$("#clock12").hasClass("select")) {
          $("#clock12").toggleClass("select");
          $("#clock24").toggleClass("select");
          $("#ltr").text(AST.T12h($("#ltr").attr("data-time")));
          $("#ltn").text(AST.T12h($("#ltn").attr("data-time")));
          $("#astt").text(AST.T12h($("#astt").attr("data-time")));
          AST.setCookie('ASTClock', 1);
          $("#op1 span").text(AST.Options_Clicks().option1);
          $("#op2 span").text(AST.Options_Clicks().option2);
          AST.Rscript();
          AST.LangCSS();
          AST.Protect_Option();
        }

      });
      $("#clock24").on("click", function () {
        if (!$("#clock24").hasClass("select")) {
          $("#clock24").toggleClass("select");
          $("#clock12").toggleClass("select");
          $("#ltr").text($("#ltr").attr("data-time"));
          $("#ltn").text($("#ltn").attr("data-time"));
          $("#astt").text($("#astt").attr("data-time"));
          AST.deleteCookie('ASTClock');
          $("#op1 span").text(AST.Options_Clicks().option1);
          $("#op2 span").text(AST.Options_Clicks().option2);
          AST.Rscript();
          AST.LangCSS();
          AST.Protect_Option();
        }
      });
    },
    Clock: function () {
      if (AST.getCookie('ASTClock') == 1) {
        $("#ltn").text(AST.T12h($("#ltn").text()));
        $("#ltr").text(AST.T12h($("#ltr").text()));
        $("#astt").text(AST.T12h($("#astt").text()));
      }
      else {
        $("#ltr").text($("#ltr").attr("data-time"));
        $("#ltn").text($("#ltn").attr("data-time"));
        $("#astt").text($("#astt").attr("data-time"));
      }
    },
    Select_Protect: function () {
      if (AST.getCookie('ASTProtect') == 1) {
        $("#pf_no").toggleClass("select");
        $("#pf_yes").toggleClass("select");
      }
      $("#pf_no").on("click", function () {
        if (!$("#pf_no").hasClass("select")) {
          $("#pf_no").toggleClass("select");
          $("#pf_yes").toggleClass("select");
          AST.setCookie('ASTProtect', 1);
          AST.Protect_Option();
        }
      });
      $("#pf_yes").on("click", function () {
        if (!$("#pf_yes").hasClass("select")) {
          $("#pf_yes").toggleClass("select");
          $("#pf_no").toggleClass("select");
          AST.deleteCookie('ASTProtect');
          AST.Protect_Option();
        }
      });
    },
    T12h: function (t) {
      time = t.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [t];
      if (time.length > 1) {
        time = time.slice(1);
        time[5] = +time[0] < 12 ? ' AM' : ' PM';
        time[0] = +time[0] % 12 || 12;
      }
      return time.join('');
    },
    setCookie: function (name, value, expires = 999999, path = '/m/v/', domain = 'neobux.com', secure = '') {
      var today = new Date();
      today.setTime(today.getTime());
      if (expires) {
        expires = expires * 1000 * 60 * 60 * 24;
      }
      var expires_date = new Date(today.getTime() + (expires));
      document.cookie = name + '=' + escape(value) + ((expires) ? ';expires=' + expires_date.toGMTString() : '') + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ((secure) ? ';secure' : '');
    },
    getCookie: function (name) {
      var start = document.cookie.indexOf(name + "=");
      var len = start + name.length + 1;
      if ((!start) && (name != document.cookie.substring(0, name.length))) {
        return null;
      }
      if (start == -1) return null;
      var end = document.cookie.indexOf(';', len);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(len, end));
    },
    deleteCookie: function (name, path = '/m/v/', domain = 'neobux.com') {
      if (AST.getCookie(name)) document.cookie = name + '=' + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
    },
    Rscript: function () {
      if (AST.getCookie('ASTOption') == 1) {
        if (AST.getCookie('ASTClock') == 1) {
          $("body").append("<script>mk_tt('ast_info','rm','" + AST.strFormat(Lang.Ads_Help_Info, AST.Server_Time().user_nd12, AST.Server_Time().user_ra12) + "');</script>");
        }
        else {
          $("body").append("<script>mk_tt('ast_info','rm','" + AST.strFormat(Lang.Ads_Help_Info, AST.Server_Time().user_nd, AST.Server_Time().user_ra) + "');</script>");
        }
      }
      else {
        if (AST.getCookie('ASTClock') == 1) {
          $("body").append("<script>mk_tt('ast_info','rm','" + AST.strFormat(Lang.Ads_Help_Info, AST.Server_Time().user_ra12, AST.Server_Time().user_nd12) + "');</script>");
        }
        else {
          $("body").append("<script>mk_tt('ast_info','rm','" + AST.strFormat(Lang.Ads_Help_Info, AST.Server_Time().user_ra, AST.Server_Time().user_nd) + "');</script>");
        }
      }
    },
    WOption_pos: function () {
      if ($("#ubar_w").css("position") == 'fixed') {
        $("#ast_op").css({
          "position": "fixed",
          "top":"150px"
        });
      }
      $("#ubars2").on("click", function (e) {
        if ($("#ubar_w").css("position") == 'fixed') {
          $("#ast_op").css({
            "position": "fixed",
            "top":"150px"
          });
        }
        else {
          $("#ast_op").css({
            "position": "",
            "top":""
          });
        }
      });
    },
    Options_abbreviation: function () {
      $(document).on("keypress", function (e) {
        if (((e.ctrlKey && e.shiftKey) || (e.shiftKey)) && (e.which === 111 || e.which === 79)) {
          $("#ast_op").toggle(0, function () {
            switch ($("#ast_op").css("display")) {
              case 'block':
                $("#ast_op").html(
                  '<div id="ast_opc">' +
                  '<div class="ast_t">' + Lang.Pop_op_Title + ' <span id="ast_cop"></span></div>' +
                  '<div class="ast_o"><p>' + Lang.Pop_op_Option_Desc + '</p>' +
                  '<div class="opc">' +
                  '<div id="op1" class="op o1">' + Lang.Pop_op_Option_1 + ' <span>' + AST.Options_Clicks().option1 + '</span></div>' +
                  '<div id="op2" class="op o1 select">' + Lang.Pop_op_Option_2 + ' <span>' + AST.Options_Clicks().option2 + '</span></div>' +
                  '</div>' +
                  '<p>' + Lang.Pop_op_Time_Desc + '</p>' +
                  '<div class="opc">' +
                  '<div id="clock12" class="op o2">' + Lang.Pop_op_Time_1 + '</div>' +
                  '<div id="clock24" class="op o2 select">' + Lang.Pop_op_Time_2 + '</div>' +
                  '</div>' +
                  '<p>' + Lang.Pop_op_Protect_Desc + '</p>' +
                  '<div class="opc">' +
                  '<div id="pf_no" class="op o3">' + Lang.Pop_op_Protect_1 + '</div>' +
                  '<div id="pf_yes" class="op o3 select">' + Lang.Pop_op_Protect_2 + '</div>' +
                  '</div></div></div>'
                );
                $("#ast_cop").on("click", function () {
                  $("#ast_op").toggle(0, function () {
                    $("#ast_opc").remove();
                  });
                });
                AST.Options_Clicks();
                AST.Select_Time();
                AST.Select_Protect();
                AST.Protect_Option();
                break;
              case 'none':
              default:
                $("#ast_opc").remove();
            }
          });
        }
        if ((e.shiftKey) && (e.which === 33)) {
          $(function () {
            if (!AST.getCookie('ASTOption')) {
              if (!$("#op1").hasClass("select")) {
                $("#op1").toggleClass("select");
                $("#op2").toggleClass("select");
              }
              else {
                $("#op2").toggleClass("select");
                $("#op1").toggleClass("select");
              }
              AST.setCookie('ASTOption', 1);
              AST.Protect_Option();
              $("#ast_info").after('<span id="ast_rinfo"></span>');
              setTimeout(function () {
                $('[id="ast_rinfo"]').remove();
              }, 250);
              AST.Rscript();
            }
          });
        }
        if ((e.shiftKey) && (e.which === 64)) {
          $(function () {
            if (AST.getCookie('ASTOption') == 1) {
              if (!$("#op2").hasClass("select")) {
                $("#op2").toggleClass("select");
                $("#op1").toggleClass("select");
              }
              else {
                $("#op1").toggleClass("select");
                $("#op2").toggleClass("select");
              }
              AST.deleteCookie('ASTOption');
              AST.Protect_Option();
              $("#ast_info").after('<span id="ast_rinfo"></span>');
              setTimeout(function () {
                $('[id="ast_rinfo"]').remove();
              }, 250);
              AST.Rscript();
            }
          });
        }
        if ((e.shiftKey) && ((e.which === 84) || (e.which === 116))) {
          $(function () {
            if (!$("#clock24").hasClass("select")) {
              $("#clock24").toggleClass("select");
              $("#clock12").toggleClass("select");
            }
            else {
              $("#clock12").toggleClass("select");
              $("#clock24").toggleClass("select");
            }
            if (AST.getCookie('ASTClock') == 1) {
              AST.deleteCookie('ASTClock');
              AST.Clock();
              $("#op1 span").text(AST.Options_Clicks().option1);
              $("#op2 span").text(AST.Options_Clicks().option2);
              $("#ast_info").after('<span id="ast_rinfo"></span>');
              setTimeout(function () {
                $('[id="ast_rinfo"]').remove();
              }, 250);
              AST.Rscript();
              AST.LangCSS();
              AST.Protect_Option();
            }
            else {
              AST.setCookie('ASTClock', 1);
              AST.Clock();
              $("#op1 span").text(AST.Options_Clicks().option1);
              $("#op2 span").text(AST.Options_Clicks().option2);
              $("#ast_info").after('<span id="ast_rinfo"></span>');
              setTimeout(function () {
                $('[id="ast_rinfo"]').remove();
              }, 250);
              AST.Rscript();
              AST.LangCSS();
              AST.Protect_Option();
            }
          });
        }
        if ((e.shiftKey) && ((e.which === 80) || (e.which === 112))) {
          $(function () {
            if (AST.getCookie('ASTProtect') == 1) {
              AST.deleteCookie('ASTProtect');
              AST.Protect_Option();
            }
            else {
              AST.setCookie('ASTProtect', 1);
              AST.Protect_Option();
            }
            if (!$("#pf_yes").hasClass("select")) {
              $("#pf_yes").toggleClass("select");
              $("#pf_no").toggleClass("select");
            }
            else {
              $("#pf_no").toggleClass("select");
              $("#pf_yes").toggleClass("select");
            }
          });
        }
        if (!$("#ast_op").is(":visible")) {
          if (e.shiftKey) {
            switch (e.which) {
              case 33:
              case 64:
                if (AST.getCookie('ASTOption') == 1) {
                  $("#ast_cp #p").text(Lang.Pop_Option_1);
                  $("#ast_cp").stop().fadeIn(0, function () {
                    $("#ast_info").after('<span id="ast_rinfo"></span>');
                    setTimeout(function () {
                      $("#ast_cp").stop().fadeOut('fast', function () {
                        $('[id="ast_rinfo"]').remove();
                        $("#ast_cp #p").empty();
                      });
                    }, 250);

                  });
                }
                else {
                  $("#ast_cp #p").text(Lang.Pop_Option_2);
                  $("#ast_cp").stop().fadeIn(0, function () {
                    $("#ast_info").after('<span id="ast_rinfo"></span>');
                    setTimeout(function () {
                      $("#ast_cp").stop().fadeOut('fast', function () {
                        $('[id="ast_rinfo"]').remove();
                        $("#ast_cp #p").empty();
                      });
                    }, 250);
                  });
                }
                AST.Rscript();
                break;
              case 84:
              case 116:
                if (AST.getCookie('ASTClock') == 1) {
                  $("#ast_cp #p").text(Lang.Pop_Time_1);
                  $("#ast_cp").stop().fadeIn(0, function () {
                    $("#ast_info").after('<span id="ast_rinfo"></span>');
                    setTimeout(function () {
                      $("#ast_cp").stop().fadeOut('fast', function () {
                        $('[id="ast_rinfo"]').remove();
                        $("#ast_cp #p").empty();
                      });
                    }, 250);
                  });
                }
                else {
                  $("#ast_cp #p").text(Lang.Pop_Time_2);
                  $("#ast_cp").stop().fadeIn(0, function () {
                    $("#ast_info").after('<span id="ast_rinfo"></span>');
                    setTimeout(function () {
                      $("#ast_cp").stop().fadeOut('fast', function () {
                        $('[id="ast_rinfo"]').remove();
                        $("#ast_cp #p").empty();
                      });
                    }, 250);
                  });
                }
                AST.Rscript();
                AST.LangCSS();
                break;
              case 80:
              case 112:
                if (AST.getCookie('ASTProtect') == 1) {
                  $("#ast_cp #p").text(Lang.Pop_Protect_1);
                  $("#ast_cp").stop().fadeIn(0, function () {
                    setTimeout(function () {
                      $("#ast_cp").stop().fadeOut('fast', function () {
                        $("#ast_cp #p").empty();
                      });
                    }, 250);
                  });
                }
                else {
                  $("#ast_cp #p").text(Lang.Pop_Protect_2);
                  $("#ast_cp").stop().fadeIn(0, function () {
                    setTimeout(function () {
                      $("#ast_cp").stop().fadeOut('fast', function () {
                        $("#ast_cp #p").empty();
                      });
                    }, 250);
                  });
                }
                break;
            }
          }
        }
      });
    }
  };
  var Lang = AST.Translate();
  AST.Mark_objects();
  AST.WOption_pos();
  AST.Style();
  AST.Clock();
  AST.Protect_Option();
});