MediaWiki:Mobile.js: Difference between revisions

From Exagear International
Jump to navigation Jump to search
(Created page with "→‎All JavaScript here will be loaded for users of the mobile site: if ( mw.config.get( 'wgIsMainPage' )) { var language = navigator.language || navigator.browserLanguage; var language = navigator.language // alert(language); if (language.indexOf('ru') > -1) { document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page(ru)'; document.location = 'https://www.exagear.wiki/index.php?title=Main_Page(ru)'; } else { document.location.href = 'https://w...")
 
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the mobile site */
/* Any JavaScript here will be loaded for all users on every page load. */
 
if ( mw.config.get( 'wgIsMainPage' )) {
if ( mw.config.get( 'wgIsMainPage' )) {




var language = navigator.language || navigator.browserLanguage;
var language = navigator.language || navigator.browserLanguage;
var language = navigator.language
 




Line 12: Line 11:
if (language.indexOf('ru') > -1) {
if (language.indexOf('ru') > -1) {
document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page(ru)';
document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page(ru)';
document.location = 'https://www.exagear.wiki/index.php?title=Main_Page(ru)';
 
} else {
} else {
document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page(en)';
document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page';
document.location = 'https://www.exagear.wiki/index.php?title=Main_Page(en)';
 
}
}
}
// HIDING ELEMENTS
// ########################
if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page"
)
{
var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}
// ########################
if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page(ru)&mobileaction=toggle_view_mobile"
)
{var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}
// ########################
if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page&mobileaction=toggle_view_mobile"
)
{
var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}
// ########################
if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page(ru)"
)
{var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}
}

Latest revision as of 13:59, 19 October 2022

/* Any JavaScript here will be loaded for all users on every page load. */
if ( mw.config.get( 'wgIsMainPage' )) {


var language = navigator.language || navigator.browserLanguage;



// alert(language);

if (language.indexOf('ru') > -1) {
document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page(ru)';

} else {
document.location.href = 'https://www.exagear.wiki/index.php?title=Main_Page';

}
}



// HIDING ELEMENTS
// ########################

if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page"
)
{
var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}

// ########################

if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page(ru)&mobileaction=toggle_view_mobile" 
)
{var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}

// ########################
if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page&mobileaction=toggle_view_mobile"
)
{
var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}
// ########################


if(
window.location.href=="https://www.exagear.wiki/index.php?title=Main_Page(ru)" 
)
{var plusLinks = document.querySelectorAll('.pre-content');
var firstLink = plusLinks[0];
firstLink.setAttribute('class', 'hidethis');
}