Diferencia entre revisiones de «MediaWiki:Common.js»

De Wiki The-West ES
Ir a la navegación.
Sin resumen de edición
Sin resumen de edición
 
(No se muestran 34 ediciones intermedias de 4 usuarios)
Línea 1: Línea 1:
//Ocultamos codigo javascript de la vista de los usuarios.
/*== Adds de Gacorosis ==*/


if(window.location.href.indexOf("MediaWiki:Common.js") > -1){


//alert(document.getElementByClass("mw-editinginterface").innerText);
$.getScript("/wiki/Calculators.js?action=raw", function() {});
//document.getElementById("mw-content-text").remove();
$('body').append($('<div></div>').load('https://wiki.the-west.es/wiki/OptionBar.html?action=raw'));
$('body').append($('<div></div>').load('https://wiki.the-west.es/wiki/NavBarMobile.html?action=raw'));
//$.getScript("https://wiki.the-west.es/wiki/OptionBar.js?action=raw", function() {});


}
/*== FIN de Adds de Gacorosis ==*/


//Ocultamos codigo javascript de la vista de los usuarios.
/*


//Codigo para sortear claves de la wiki.
//Codigo para sortear claves de la wiki.
if(Math.floor(Math.random()* 1001) === 500 && window.location.href !== "https://wiki.the-west.es/wiki/MediaWiki:Common.js"){alert("¡Hola vaquero! Has sido seleccionado para obtener un premio, introduce el siguiente código (348fc78d) en el juego antes que nadie para obtenerlo.\n \nEs muy importante que no cierres esta ventana sin anotarte en algún sitio el código ya que luego no podrás recuperarlo.");}
if(Math.floor(Math.random()* 1001) === 500 && window.location.href !== "https://wiki.the-west.es/wiki/MediaWiki:Common.js"){alert("¡Hola vaquero! Has sido seleccionado para obtener un premio, introduce el siguiente código (348fc78d) en el juego antes que nadie para obtenerlo.\n \nEs muy importante que no cierres esta ventana sin anotarte en algún sitio el código ya que luego no podrás recuperarlo.");}


*/
//Codigo para implementar un canvas para cuando vayamos a usarlo.
//Codigo para implementar un canvas para cuando vayamos a usarlo.
if(false){
var canvas = document.createElement('canvas');
var div = document.getElementById('idDiv');
canvas.id = "CursorLayer";
canvas.width  = 1224;
canvas.height = 768;
canvas.style.zIndex  = 8;
canvas.style.position = "absolute";
canvas.style.border  = "1px solid";
div.appendChild(canvas)
}


//Añadido para los popups de los items
//Añadido para los popups de los items
Línea 47: Línea 37:
}
}


//Prueba
// Meter videos de youtube
var nr_intrebari = 65;
if ($('.youtube_video').length !== 0) {
var anunt_list
    $('.youtube_video').each(function() {
var nr_anunturi
        $(this).html('<iframe width="100%" height="100%" src="https://www.youtube.com/embed/' + $(this).attr('data-id') + '?cc_load_policy=1&cc_lang_pref=' + $(this).attr('data-subtitles') + '" frameborder="0" allowfullscreen></iframe>');
var anunt_curent
    });
var anunt_timer, hint_timer;
 
function ch_hints() {
  var hint_nr=Math.round(Math.random()*nr_intrebari);
  $("#west_ro_hints").slideUp("slow");
  $.get("/index.php",{title:"FAQ ",action:"raw",section:hint_nr}, function(response,succes) {
      if (succes) {
      resp= "__NOEDITSECTION__" + response
      $.get("/api.php",{action:"parse",text:resp,format:"xml"},function(xresp,succ) {
          if (succ) {
              $("#west_ro_hints").html(xresp.getElementsByTagName("text")[0].childNodes[0].nodeValue);
          }
      },"xml");
      };
},"html");
  $("#west_ro_hints").slideDown("slow");
}
}


function ch_anunt() {
//Quests header translation & repeatable translation - Criminus
        $(anunt_list[anunt_curent]).fadeOut("normal",function() {
$(".prq_dispo b").each(function() {
            anunt_curent++;
    $(this).text($(this).text().replace(/from/g, "desde el").replace(/at/g, "a las").replace(/until/g, "hasta el"));  
            if (anunt_curent >= nr_anunturi) {
});
                anunt_curent=0;
//Quest Realtime Search - Criminus
            }
            $(anunt_list[anunt_curent]).fadeIn();
        });
}
 
 
$(document).ready(function() {
$(".anunt_primapagina").hide();
  anunt_list = $(".anunt_primapagina").toArray();
  nr_anunturi=anunt_list.length;
  anunt_curent=0;
  // console.info("a:"+anunt_list+"; nr:"+nr_anunturi);
  if (nr_anunturi > 1) {
      $(anunt_list[0]).fadeIn();
      anunt_timer=window.setInterval("ch_anunt()",10000);
  } else {
      if (nr_anunturi > 0) {
            $(".anunt_primapagina").fadeIn();
        }
  } 
 


 
/**
  if ((wgAction != "edit") && (wgCanonicalNamespace != "Special") && (wgCanonicalNamespace != "Template") && (wgCanonicalNamespace != "Help") && (wgCanonicalNamespace != "Project") && (wgCanonicalNamespace != "File") && (wgTitle != "Global.js") && (wgTitle != "Script:TheWest FAQ") ) {
  stickybits - Stickybits is a lightweight alternative to `position: sticky` polyfills
$("#content").before("<div style='clear:both'></div><div id='west_ro_hints_container' style='padding: 10px 15px; background: url(&quot;/skins/thewest/images/content/contentBg.png&quot;) repeat scroll 0% 0% transparent; width: 610px; min-height:100px; text-align: center;'><a title='Inchide' href='#' id='west_ro_close_hints'><img style='float:right; height:26px; width:33px;' src='http://wiki.the-west.ro/images/a/a5/X.png' /></a><img id='west_ro_hints_image' style='position:relative; float:right; height:75px; width:75; top:35px; left:0px;' src='http://wiki.the-west.ro/images/b/b4/Tw-wiki.png' alt='Ponturi' /> <span id='west_ro_hints' style='width:80%'></span></div>");
  @version v3.4.1
  ch_hints();
  @link https://github.com/dollarshaveclub/stickybits#readme
  hint_timer=window.setInterval("ch_hints()",30000);
  @author Jeff Wainwright <yowainwright@gmail.com> (https://jeffry.in)
  $("#west_ro_close_hints").click(function() {
  @license MIT
        hint_timer=window.clearInterval(hint_timer);
**/
        $("#west_ro_hints").slideUp("slow", function() {
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s():"function"==typeof define&&define.amd?define(s):s()}(0,function(){"use strict";var s=function(){function t(t,s){var e=void 0!==s?s:{};this.version="3.4.1",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={customStickyChangeNumber:e.customStickyChangeNumber||null,noStyles:e.noStyles||!1,stickyBitStickyOffset:e.stickyBitStickyOffset||0,parentClass:e.parentClass||"js-stickybit-parent",scrollEl:"string"==typeof e.scrollEl?document.querySelector(e.scrollEl):e.scrollEl||window,stickyClass:e.stickyClass||"js-is-sticky",stuckClass:e.stuckClass||"js-is-stuck",stickyChangeClass:e.stickyChangeClass||"js-is-sticky--change",useStickyClasses:e.useStickyClasses||!1,useFixed:e.useFixed||!1,verticalPosition:e.verticalPosition||"top"};var i=this.props;i.positionVal=this.definePosition()||"fixed";var n=i.verticalPosition,o=i.noStyles,a=i.positionVal;this.els="string"==typeof t?document.querySelectorAll(t):t,"length"in this.els||(this.els=[this.els]),this.instances=[];for(var r=0;r<this.els.length;r+=1){var l=this.els[r],c=l.style;if(c[n]="top"!==n||o?"":i.stickyBitStickyOffset+"px",c.position="fixed"!==a?a:"","fixed"===a||i.useStickyClasses){var f=this.addInstance(l,i);this.instances.push(f)}}return this}var s=t.prototype;return s.definePosition=function(){var t;if(this.props.useFixed)t="fixed";else{for(var s=["","-o-","-webkit-","-moz-","-ms-"],e=document.head.style,i=0;i<s.length;i+=1)e.position=s[i]+"sticky";t=e.position?e.position:"fixed",e.position=""}return t},s.addInstance=function(t,s){var e=this,i={el:t,parent:t.parentNode,props:s};this.isWin=this.props.scrollEl===window;var n=this.isWin?window:this.getClosestParent(i.el,i.props.scrollEl);return this.computeScrollOffsets(i),i.parent.className+=" "+s.parentClass,i.state="default",i.stateContainer=function(){return e.manageState(i)},n.addEventListener("scroll",i.stateContainer),i},s.getClosestParent=function(t,s){var e=s,i=t;if(i.parentElement===e)return e;for(;i.parentElement!==e;)i=i.parentElement;return e},s.getOffsetTop=function(t){for(var s=0;s=t.offsetTop+s,t=t.offsetParent;);return s},s.computeScrollOffsets=function(t){var s=t,e=s.props,i=s.el,n=s.parent,o=!this.isWin&&"fixed"===e.positionVal,a="bottom"!==e.verticalPosition,r=o?this.getOffsetTop(e.scrollEl):0,l=o?this.getOffsetTop(n)-r:this.getOffsetTop(n),c=null!==e.customStickyChangeNumber?e.customStickyChangeNumber:i.offsetHeight;return s.offset=r+e.stickyBitStickyOffset,s.stickyStart=a?l-s.offset:0,s.stickyChange=s.stickyStart+c,s.stickyStop=a?l+n.offsetHeight-(s.el.offsetHeight+s.offset):l+n.offsetHeight,s},s.toggleClasses=function(t,s,e){var i=t,n=i.className.split(" ");e&&-1===n.indexOf(e)&&n.push(e);var o=n.indexOf(s);-1!==o&&n.splice(o,1),i.className=n.join(" ")},s.manageState=function(t){var s=t,e=s.el,i=s.props,n=s.state,o=s.stickyStart,a=s.stickyChange,r=s.stickyStop,l=e.style,c=i.noStyles,f=i.positionVal,u=i.scrollEl,p=i.stickyClass,h=i.stickyChangeClass,y=i.stuckClass,d=i.verticalPosition,k=function(t){t()},m=this.isWin&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)||k,g=this.toggleClasses,v=this.isWin?window.scrollY||window.pageYOffset:u.scrollTop,C=v<=o&&"sticky"===n,w=r<=v&&"sticky"===n;o<v&&v<r&&("default"===n||"stuck"===n)?(s.state="sticky",m(function(){g(e,y,p),l.position=f,c||(l.bottom="",l[d]=i.stickyBitStickyOffset+"px")})):C?(s.state="default",m(function(){g(e,p),"fixed"===f&&(l.position="")})):w&&(s.state="stuck",m(function(){g(e,p,y),"fixed"!==f||c||(l.top="",l.bottom="0",l.position="absolute")}));var S=a<=v&&v<=r;return v<a||r<v?m(function(){g(e,h)}):S&&m(function(){g(e,"stub",h)}),s},s.update=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];this.computeScrollOffsets(s)}return this},s.removeInstance=function(t){var s=t.el,e=t.props,i=this.toggleClasses;s.style.position="",s.style[e.verticalPosition]="",i(s,e.stickyClass),i(s,e.stuckClass),i(s.parentNode,e.parentClass)},s.cleanup=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];s.props.scrollEl.removeEventListener("scroll",s.stateContainer),this.removeInstance(s)}this.manageState=!1,this.instances=[]},t}();if("undefined"!=typeof window){var t=window.$||window.jQuery||window.Zepto;t&&(t.fn.stickybits=function(t){return new s(this,t)})}});
            $("#west_ro_close_hints").hide();
$('#right_menu').stickybits({stickyBitStickyOffset: 25});
            $("#west_ro_hints_image").hide();
            $("#west_ro_hints_container").css("min-height","0px");
        });
  });
       
  }
  if ((wgTitle == "Global.js") && (wgAction != "edit") && (wgAction != "history") && (wgAction != "historysubmit") && (wgAction != "protect") && (wgAction != "unprotect")) {
    $("#bodyContent").html("<p>Pentru evitarea eventualelor neplaceri am restrictionat accesul la aceasta pagina!<br>Documentare placuta in continuare!</p><p>Echipa <a href='http://the-west.ro'>The West.ro</a>!</p>");
    }
 
 
});

Revisión actual - 22:47 20 feb 2024

/*== Adds de Gacorosis ==*/


$.getScript("/wiki/Calculators.js?action=raw", function() {});
$('body').append($('<div></div>').load('https://wiki.the-west.es/wiki/OptionBar.html?action=raw'));
$('body').append($('<div></div>').load('https://wiki.the-west.es/wiki/NavBarMobile.html?action=raw'));
//$.getScript("https://wiki.the-west.es/wiki/OptionBar.js?action=raw", function() {});

/*== FIN de Adds de Gacorosis ==*/


//Ocultamos codigo javascript de la vista de los usuarios.
/*

//Codigo para sortear claves de la wiki.
if(Math.floor(Math.random()* 1001) === 500 && window.location.href !== "https://wiki.the-west.es/wiki/MediaWiki:Common.js"){alert("¡Hola vaquero! Has sido seleccionado para obtener un premio, introduce el siguiente código (348fc78d) en el juego antes que nadie para obtenerlo.\n \nEs muy importante que no cierres esta ventana sin anotarte en algún sitio el código ya que luego no podrás recuperarlo.");}

*/
//Codigo para implementar un canvas para cuando vayamos a usarlo.

//Añadido para los popups de los items
if ($('.item_container').length!==0) {
    $('.item_container').each(function() {
        $(this).append('<img src="https://westes.innogamescdn.com/images/items/' + $(this).attr('data-url') + '">');
});
    $('.item_container[data-link]').each(function() {
        $(this).find('img').wrap('<a href="' + $(this).attr('data-link') + '"></a>');
    });
    $(function() {
        $.getScript("https://wiki.the-west.es/wiki/Popup.js?action=raw");
    });
} 
//Añadido para la barra de navegación 

if ($('#navbar').length !== 0) {
    $('#navbar a').removeAttr("title");
}

// Meter videos de youtube
if ($('.youtube_video').length !== 0) {
    $('.youtube_video').each(function() {
        $(this).html('<iframe width="100%" height="100%" src="https://www.youtube.com/embed/' + $(this).attr('data-id') + '?cc_load_policy=1&cc_lang_pref=' + $(this).attr('data-subtitles') + '" frameborder="0" allowfullscreen></iframe>');
    });
}

//Quests header translation & repeatable translation - Criminus
$(".prq_dispo b").each(function() {
    $(this).text($(this).text().replace(/from/g, "desde el").replace(/at/g, "a las").replace(/until/g, "hasta el")); 
});
//Quest Realtime Search - Criminus

/**
  stickybits - Stickybits is a lightweight alternative to `position: sticky` polyfills
  @version v3.4.1
  @link https://github.com/dollarshaveclub/stickybits#readme
  @author Jeff Wainwright <yowainwright@gmail.com> (https://jeffry.in)
  @license MIT
**/
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s():"function"==typeof define&&define.amd?define(s):s()}(0,function(){"use strict";var s=function(){function t(t,s){var e=void 0!==s?s:{};this.version="3.4.1",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={customStickyChangeNumber:e.customStickyChangeNumber||null,noStyles:e.noStyles||!1,stickyBitStickyOffset:e.stickyBitStickyOffset||0,parentClass:e.parentClass||"js-stickybit-parent",scrollEl:"string"==typeof e.scrollEl?document.querySelector(e.scrollEl):e.scrollEl||window,stickyClass:e.stickyClass||"js-is-sticky",stuckClass:e.stuckClass||"js-is-stuck",stickyChangeClass:e.stickyChangeClass||"js-is-sticky--change",useStickyClasses:e.useStickyClasses||!1,useFixed:e.useFixed||!1,verticalPosition:e.verticalPosition||"top"};var i=this.props;i.positionVal=this.definePosition()||"fixed";var n=i.verticalPosition,o=i.noStyles,a=i.positionVal;this.els="string"==typeof t?document.querySelectorAll(t):t,"length"in this.els||(this.els=[this.els]),this.instances=[];for(var r=0;r<this.els.length;r+=1){var l=this.els[r],c=l.style;if(c[n]="top"!==n||o?"":i.stickyBitStickyOffset+"px",c.position="fixed"!==a?a:"","fixed"===a||i.useStickyClasses){var f=this.addInstance(l,i);this.instances.push(f)}}return this}var s=t.prototype;return s.definePosition=function(){var t;if(this.props.useFixed)t="fixed";else{for(var s=["","-o-","-webkit-","-moz-","-ms-"],e=document.head.style,i=0;i<s.length;i+=1)e.position=s[i]+"sticky";t=e.position?e.position:"fixed",e.position=""}return t},s.addInstance=function(t,s){var e=this,i={el:t,parent:t.parentNode,props:s};this.isWin=this.props.scrollEl===window;var n=this.isWin?window:this.getClosestParent(i.el,i.props.scrollEl);return this.computeScrollOffsets(i),i.parent.className+=" "+s.parentClass,i.state="default",i.stateContainer=function(){return e.manageState(i)},n.addEventListener("scroll",i.stateContainer),i},s.getClosestParent=function(t,s){var e=s,i=t;if(i.parentElement===e)return e;for(;i.parentElement!==e;)i=i.parentElement;return e},s.getOffsetTop=function(t){for(var s=0;s=t.offsetTop+s,t=t.offsetParent;);return s},s.computeScrollOffsets=function(t){var s=t,e=s.props,i=s.el,n=s.parent,o=!this.isWin&&"fixed"===e.positionVal,a="bottom"!==e.verticalPosition,r=o?this.getOffsetTop(e.scrollEl):0,l=o?this.getOffsetTop(n)-r:this.getOffsetTop(n),c=null!==e.customStickyChangeNumber?e.customStickyChangeNumber:i.offsetHeight;return s.offset=r+e.stickyBitStickyOffset,s.stickyStart=a?l-s.offset:0,s.stickyChange=s.stickyStart+c,s.stickyStop=a?l+n.offsetHeight-(s.el.offsetHeight+s.offset):l+n.offsetHeight,s},s.toggleClasses=function(t,s,e){var i=t,n=i.className.split(" ");e&&-1===n.indexOf(e)&&n.push(e);var o=n.indexOf(s);-1!==o&&n.splice(o,1),i.className=n.join(" ")},s.manageState=function(t){var s=t,e=s.el,i=s.props,n=s.state,o=s.stickyStart,a=s.stickyChange,r=s.stickyStop,l=e.style,c=i.noStyles,f=i.positionVal,u=i.scrollEl,p=i.stickyClass,h=i.stickyChangeClass,y=i.stuckClass,d=i.verticalPosition,k=function(t){t()},m=this.isWin&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)||k,g=this.toggleClasses,v=this.isWin?window.scrollY||window.pageYOffset:u.scrollTop,C=v<=o&&"sticky"===n,w=r<=v&&"sticky"===n;o<v&&v<r&&("default"===n||"stuck"===n)?(s.state="sticky",m(function(){g(e,y,p),l.position=f,c||(l.bottom="",l[d]=i.stickyBitStickyOffset+"px")})):C?(s.state="default",m(function(){g(e,p),"fixed"===f&&(l.position="")})):w&&(s.state="stuck",m(function(){g(e,p,y),"fixed"!==f||c||(l.top="",l.bottom="0",l.position="absolute")}));var S=a<=v&&v<=r;return v<a||r<v?m(function(){g(e,h)}):S&&m(function(){g(e,"stub",h)}),s},s.update=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];this.computeScrollOffsets(s)}return this},s.removeInstance=function(t){var s=t.el,e=t.props,i=this.toggleClasses;s.style.position="",s.style[e.verticalPosition]="",i(s,e.stickyClass),i(s,e.stuckClass),i(s.parentNode,e.parentClass)},s.cleanup=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];s.props.scrollEl.removeEventListener("scroll",s.stateContainer),this.removeInstance(s)}this.manageState=!1,this.instances=[]},t}();if("undefined"!=typeof window){var t=window.$||window.jQuery||window.Zepto;t&&(t.fn.stickybits=function(t){return new s(this,t)})}});
$('#right_menu').stickybits({stickyBitStickyOffset: 25});