mirror of
https://github.com/transmission/transmission.git
synced 2025-12-23 11:58:36 +00:00
Web UI: main() refactoring (patch by skybon @ GH-9)
Less jQuery, more Web API. Moved main() away from common.
This commit is contained in:
52
web/javascript/main.js
Normal file
52
web/javascript/main.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright © Dave Perrett, Malcolm Jarvis and Artem Vorotnikov
|
||||
*
|
||||
* This file is licensed under the GPLv2.
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
function main() {
|
||||
// IE specific fixes here
|
||||
if (jQuery.browser.msie) {
|
||||
try {
|
||||
document.execCommand("BackgroundImageCache", false, true);
|
||||
} catch (err) {};
|
||||
};
|
||||
|
||||
if (jQuery.browser.safari) {
|
||||
// Move search field's margin down for the styled input
|
||||
document.getElementById("torrent_search").style["margin-top"] = 3;
|
||||
};
|
||||
|
||||
if (isMobileDevice) {
|
||||
window.onload = function () {
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, 1);
|
||||
}, 500);
|
||||
};
|
||||
window.onorientationchange = function () {
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, 1);
|
||||
}, 100);
|
||||
};
|
||||
if (window.navigator.standalone) {
|
||||
// Fix min height for isMobileDevice when run in full screen mode from home screen
|
||||
// so the footer appears in the right place
|
||||
document.getElementById("torrent_container").style["min-height"] = "338px";
|
||||
};
|
||||
document.querySelector("label[for=torrent_upload_url]").textContent("URL: ");
|
||||
} else {
|
||||
// Fix for non-Safari-3 browsers: dark borders to replace shadows.
|
||||
Array.from(document.getElementsByClassName("dialog_window")).forEach(function (e) {
|
||||
e.style["border"] = "1px solid #777";
|
||||
});
|
||||
};
|
||||
|
||||
// Initialise the dialog controller
|
||||
dialog = new Dialog();
|
||||
|
||||
// Initialise the main Transmission controller
|
||||
transmission = new Transmission();
|
||||
};
|
||||
|
||||
document.addEventListener("DOMContentLoaded", main);
|
||||
Reference in New Issue
Block a user