Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
Created February 26, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZiTAL/e28a4a506d8d25e025c2185812b385ce to your computer and use it in GitHub Desktop.
Save ZiTAL/e28a4a506d8d25e025c2185812b385ce to your computer and use it in GitHub Desktop.
Javascript: 8M Greba feminista
/*
2018ko Martxoaren 8an greba feminista, goizeko 11etatik 15tara, arratsaldeko 18tatik 22tara
*/
(function()
{
function setModal()
{
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
var div = document.createElement('div');
div.className = 'greba8m';
div.style.display = 'block';
div.style.position = 'fixed';
div.style.top = 0;
div.style.left = 0;
div.style.backgroundColor = '#000000';
div.style.width = '100%';
div.style.height = '1000px';
div.style.opacity = '0.8';
div.style.overflow = 'hidden';
div.style.zIndex = '999';
var div2 = document.createElement('div');
div2.className = 'greba8m';
div2.style.display = 'block';
div2.style.position = 'fixed';
div2.style.top = (y / 2 - 189) +"px";
div2.style.left = (x / 2 - 258) +"px";
div2.style.color = '#000000';
div2.style.backgroundColor = '#ffffff';
div2.style.width = '515px';
div2.style.height = '378px';
div2.style.zIndex = '1000';
var img = document.createElement('img');
img.src = 'https://grebafeminista.files.wordpress.com/2018/02/pegatapequec3b1a2.jpg';
img.alt = 'Gune hau greba feministarekin bat'
img.style.width = '515px';
img.style.height = '378px';
div2.appendChild(img);
var body = document.getElementsByTagName('body')[0];
body.appendChild(div);
body.appendChild(div2);
}
var d = new Date();
var dd =
{
'y': d.getFullYear(),
'm': window.parseInt(d.getMonth())+1,
'd': d.getDate(),
'h': d.getHours(),
'i': d.getMinutes(),
's': d.getSeconds()
};
if(dd['y']===2018 && dd['m']===3 && dd['d']===8)
{
if((dd['h']>10 && dd['h']<15) || (dd['h']>17 && dd['h']<22))
{
setModal();
window.setInterval(function()
{
var a = document.querySelectorAll('.greba8m');
if(a.length<2)
setModal();
}, 1 * 5000);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment