Widget:Test: mudanças entre as edições

De PokeXGames
Ir para navegação Ir para pesquisar
(Criou página com '<script> console.log("Olá"); </script>')
 
Sem resumo de edição
Linha 1: Linha 1:
<script>
<script>
  console.log("Olá");
 
 
/**
  * Returns the week number for this date. dowOffset is the day of week the week
* "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday),
* the week returned is the ISO 8601 week number.
* @param int dowOffset
* @return int
*/
Date.prototype.getWeek = function (dowOffset) {
    /*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
 
    dowOffset = typeof (dowOffset) == 'number' ? dowOffset : 0; //default dowOffset to zero
    var newYear = new Date(this.getFullYear(), 0, 1);
    var day = newYear.getDay() - dowOffset; //the day of week the year begins on
    day = (day >= 0 ? day : day + 7);
    var daynum = Math.floor((this.getTime() - newYear.getTime() -
        (this.getTimezoneOffset() - newYear.getTimezoneOffset()) * 60000) / 86400000) + 1;
    var weeknum;
    //if the year starts before the middle of a week
    if (day < 4) {
        weeknum = Math.floor((daynum + day - 1) / 7) + 1;
        if (weeknum > 52) {
            nYear = new Date(this.getFullYear() + 1, 0, 1);
            nday = nYear.getDay() - dowOffset;
            nday = nday >= 0 ? nday : nday + 7;
            /*if the next year starts before the middle of
              the week, it is week #1 of that year*/
            weeknum = nday < 4 ? 1 : 53;
        }
    }
    else {
        weeknum = Math.floor((daynum + day - 1) / 7);
    }
    return weeknum;
}
 
const week = new Date().getWeek();
 
const bossCard = document.getElementById('boss-card');
 
const bosses = [
    {
        name: 'Suicune',
        image: 'Card_Boss-Fight-Suicune.png'
    },
    {
        name: 'Entei',
        image: 'Card_Boss-Fight-Entei.png'
    },
    {
        name: 'Raikou',
        image: 'Card_Boss-Fight-Raikou.png'
    }
];
 
 
 
 
</script>
</script>

Edição das 21h07min de 22 de março de 2023

<script>


/**

* Returns the week number for this date.  dowOffset is the day of week the week
* "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday),
* the week returned is the ISO 8601 week number.
* @param int dowOffset
* @return int
*/

Date.prototype.getWeek = function (dowOffset) {

   /*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
   dowOffset = typeof (dowOffset) == 'number' ? dowOffset : 0; //default dowOffset to zero
   var newYear = new Date(this.getFullYear(), 0, 1);
   var day = newYear.getDay() - dowOffset; //the day of week the year begins on
   day = (day >= 0 ? day : day + 7);
   var daynum = Math.floor((this.getTime() - newYear.getTime() -
       (this.getTimezoneOffset() - newYear.getTimezoneOffset()) * 60000) / 86400000) + 1;
   var weeknum;
   //if the year starts before the middle of a week
   if (day < 4) {
       weeknum = Math.floor((daynum + day - 1) / 7) + 1;
       if (weeknum > 52) {
           nYear = new Date(this.getFullYear() + 1, 0, 1);
           nday = nYear.getDay() - dowOffset;
           nday = nday >= 0 ? nday : nday + 7;
           /*if the next year starts before the middle of
             the week, it is week #1 of that year*/
           weeknum = nday < 4 ? 1 : 53;
       }
   }
   else {
       weeknum = Math.floor((daynum + day - 1) / 7);
   }
   return weeknum;

}

const week = new Date().getWeek();

const bossCard = document.getElementById('boss-card');

const bosses = [

   {
       name: 'Suicune',
       image: 'Card_Boss-Fight-Suicune.png'
   },
   {
       name: 'Entei',
       image: 'Card_Boss-Fight-Entei.png'
   },
   {
       name: 'Raikou',
       image: 'Card_Boss-Fight-Raikou.png'
   }

];



</script>