Changeset 14731


Ignore:
Timestamp:
Apr 12, 2016, 7:03:01 PM (16 months ago)
Author:
mikedld
Message:

Web UI: main() refactoring (patch by skybon @ GH-9)

Less jQuery, more Web API. Moved main() away from common.

Location:
trunk/web
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/index.html

    r14570 r14731  
    2424                <script type="text/javascript" src="./javascript/jquery/jquery.transmenu.min.js"></script>
    2525                <script type="text/javascript" src="./javascript/jquery/json2.min.js"></script>
     26                <script type="text/javascript" src="./javascript/polyfill.js"></script>
    2627                <script type="text/javascript" src="./javascript/common.js"></script>
    2728                <script type="text/javascript" src="./javascript/inspector.js"></script>
     
    3536                <script type="text/javascript" src="./javascript/formatter.js"></script>
    3637                <script type="text/javascript" src="./javascript/notifications.js"></script>
     38                <script type="text/javascript" src="./javascript/main.js"></script>
    3739                <title>Transmission Web Interface</title>
    3840        </head>
  • trunk/web/javascript/Makefile.am

    r13348 r14731  
    77  formatter.js \
    88  inspector.js \
     9  main.js \
    910  notifications.js \
     11  polyfill.js \
    1012  prefs-dialog.js \
    1113  remote.js \
  • trunk/web/javascript/common.js

    r14716 r14731  
    11/**
    2  * Copyright © Dave Perrett and Malcolm Jarvis
     2 * Copyright © Dave Perrett, Malcolm Jarvis and Artem Vorotnikov
    33 *
    44 * This file is licensed under the GPLv2.
     
    1010    isMobileDevice = RegExp("(iPhone|iPod|Android)").test(navigator.userAgent),
    1111    scroll_timeout;
    12 
    13 if (!Array.indexOf) {
    14     Array.prototype.indexOf = function (obj) {
    15         var i, len;
    16         for (i = 0, len = this.length; i < len; i++) {
    17             if (this[i] == obj) {
    18                 return i;
    19             };
    20         };
    21         return -1;
    22     };
    23 };
    2412
    2513// http://forum.jquery.com/topic/combining-ui-dialog-and-tabs
     
    4432    tabul.addClass('ui-dialog-titlebar');
    4533}
    46 
    47 $(document).ready(function () {
    48 
    49     // IE8 and below don’t support ES5 Date.now()
    50     if (!Date.now) {
    51         Date.now = function () {
    52             return +new Date();
    53         };
    54     };
    55 
    56     // IE specific fixes here
    57     if ($.browser.msie) {
    58         try {
    59             document.execCommand("BackgroundImageCache", false, true);
    60         } catch (err) {};
    61         $('.dialog_container').css('height', $(window).height() + 'px');
    62     };
    63 
    64     if ($.browser.safari) {
    65         // Move search field's margin down for the styled input
    66         $('#torrent_search').css('margin-top', 3);
    67     };
    68 
    69     if (isMobileDevice) {
    70         window.onload = function () {
    71             setTimeout(function () {
    72                 window.scrollTo(0, 1);
    73             }, 500);
    74         };
    75         window.onorientationchange = function () {
    76             setTimeout(function () {
    77                 window.scrollTo(0, 1);
    78             }, 100);
    79         };
    80         if (window.navigator.standalone) {
    81             // Fix min height for isMobileDevice when run in full screen mode from home screen
    82             // so the footer appears in the right place
    83             $('body div#torrent_container').css('min-height', '338px');
    84         };
    85         $("label[for=torrent_upload_url]").text("URL: ");
    86     } else {
    87         // Fix for non-Safari-3 browsers: dark borders to replace shadows.
    88         $('div.dialog_container div.dialog_window').css('border', '1px solid #777');
    89     };
    90 
    91     // Initialise the dialog controller
    92     dialog = new Dialog();
    93 
    94     // Initialise the main Transmission controller
    95     transmission = new Transmission();
    96 });
    9734
    9835/**
Note: See TracChangeset for help on using the changeset viewer.