ମିଡ଼ିଆଉଇକି:Geonotice.js
ସୂଚନା: ବଦଳଗୁଡ଼ିକ ଦେଖିବା ପାଇଁ ଆପଣଙ୍କୁ ହୁଏତ ନିଜ ବ୍ରାଉଜର କ୍ୟାସ ବାଇପାସ କରିବାକୁ ପଡ଼ିପାରେ ।
- Firefox / Safari: Reload ଉପରେ କ୍ଲିକ କରିବା ବେଳେ Shift ଧରି କିମ୍ବା Ctrl-F5 ବା Ctrl-R ଦବାନ୍ତୁ (Macରେ ⌘-R)
- Google Chrome: Ctrl-Shift-R ଦବାନ୍ତୁ (Macରେ ⌘-Shift-R)
- Internet Explorer / Edge: Refresh ଉପରେ କ୍ଲିକ କଲା ବେଳେ Ctrl ଧରି ବା Ctrl-F5 ଦବାଇ
- Opera: Ctrl-F5 ଦବାନ୍ତୁ ।
var notices = {
/*******************************************
* End of list.
* Edit only above!
*tt
* Format is:
*
* ID:
* { begin: 'date',
* end: 'date',
* corners: [ [lat,lon], [lat,lon] ],
* text: 'message'
* }
*
* There should be commas between the notices, but not after the last one.
* Use [[meta:w:en:link|link]] format for internal links, so that they work properly on the other projects where the geonotice is displayed.
*
*******************************************/
};
function geoWikiLinker (str, page, text) {
text = text || page;
return mw.html.element(
'a', {
href: mw.util.getUrl( page ),
title: page
}, text
);
}
if ( Geo !== undefined ) {
var now = new Date(),
id, notice, insertsub, minlat, maxlat, minlon, maxlon,
regexForInternalLinks = /\[\[([^{|}\[\]\n]+)(?:\|(.*?))?\]\]/g;
for (id in notices) {
if (!document.cookie.match('hidegeonotice'+id+'=1')) {
notice = notices[id];
if (!notice || !notice.corners) {
continue;
}
minlat = Math.min(notice.corners[0][0], notice.corners[1][0]);
maxlat = Math.max(notice.corners[0][0], notice.corners[1][0]);
minlon = Math.min(notice.corners[0][1], notice.corners[1][1]);
maxlon = Math.max(notice.corners[0][1], notice.corners[1][1]);
if ( now.getTime() > Date.parse(notice.begin)
&& now.getTime() < Date.parse(notice.end)
&& minlat<Geo.lat && Geo.lat<maxlat
&& minlon<Geo.lon && Geo.lon<maxlon
) {
insertsub = document.getElementById('contentSub');
mw.util.addCSS( [
'#contentSub .geonotice {',
'width:98%;',
'margin:5px auto 0;',
'background:transparent;',
'text-align:left;',
'line-height:1.8em;',
'}',
'#contentSub .geonotice span {',
'font-size:170%;',
'}',
'#contentSub .geonotice small {',
'font-style:italic;',
'}'
].join( ' ' ) );
insertsub.innerHTML +=
'<div class="geonotice plainlinks" id="geonotice'+id+'">'+
'<span>'+notice.text.replace( regexForInternalLinks, geoWikiLinker )+'</span> '+
'<small>['+
'<a href="#" onClick="'+
'var date = new Date();'+
'date.setTime(date.getTime()+8640000000);'+
'document.cookie = \'hidegeonotice'+id+'=1;'+
'expires=\' + date.toGMTString() + \';'+
'path=/\';'+
'document.getElementById(\'geonotice'+id+'\').style.visibility = \'hidden\';'+
'return false;'+
'">hide</a>'+
']</small></div>';
}
}
}
}