미디어위키:Common.js: 두 판 사이의 차이

편집 요약 없음
mobile redirect helper 삭제
395번째 줄: 395번째 줄:
     }
     }
});
});
/** Mobile Redirect Helper ************************************************
*
*  Redirects to the mobile-optimized gateway at en.m.wikimedia.org
*  for viewers on iPhone, iPod Touch, Palm Pre, and Android devices.
*
*  You can turn off the redirect by setting the cookie "stopMobileRedirect=true"
*
*  This code cannot be imported, because the JS only loads after all other files
*  and this was causing major issues for users with mobile devices. Must be loaded
*  *before* the images and etc of the page on all mobile devices.
*
*  Maintainer: [[User:Brion VIBBER]], [[User:hcatlin]]
*/
/*
* 요청에 의해 [[:en:MediaWiki:Common.js]]에서 가져옴.
* 쿠키에 stopMobileRedirect=true 를 추가하면 비활성화됩니다.
*  * [[위키백과:사랑방/2009년 제32주#모바일 위키백과]]
*  * [[위키백과:사랑방/2009년 제50주#모바일 페이지로의 자동 이동 (auto-forward)]]
*/
if (/(Android|iPhone|iPod|webOS|NetFront|Opera Mini|SEMC-Browser|PlayStation Portable|Nintendo Wii)/.test(navigator.userAgent)) {
  var wgMainPageName = '대문';
  var stopMobileRedirectCookieExists = function() {
    return (document.cookie.indexOf("stopMobileRedirect=true") >= 0);
  }
  var mobileSiteLink = function() {
    if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Search') {
        var pageLink = '?search=' + encodeURIComponent(document.getElementById('searchText').value);
    } else if (wgPageName == wgMainPageName) {
        var pageLink = '::Home'; // Special case
    } else {
        var pageLink = encodeURIComponent(wgPageName).replace('%2F','/').replace('%3A',':');
    }
    return 'http://m.footballk.net/mediawiki/' + pageLink + "?wasRedirected=true"
  }
  if (!stopMobileRedirectCookieExists()) {
    document.location = mobileSiteLink();
  }
}