Pārlūkot izejas kodu

Fixes issues after jquery-impromptu update.

j8
paweldomas 10 gadus atpakaļ
vecāks
revīzija
581ffec5ed

+ 5
- 0
css/modaldialog.css Parādīt failu

@@ -26,4 +26,9 @@
26 26
 
27 27
 button.jqidefaultbutton #inviteLinkRef {
28 28
     color: #2c8ad2;
29
+}
30
+
31
+#inviteLinkRef {
32
+    -webkit-user-select: text;
33
+    user-select: text;
29 34
 }

+ 14
- 19
modules/UI/UI.js Parādīt failu

@@ -483,7 +483,7 @@ function onPasswordReqiured(callback) {
483 483
     message += APP.translation.translateString(
484 484
         "dialog.passwordRequired");
485 485
     message += '</h2>' +
486
-        '<input id="lockKey" type="text" data-i18n=' +
486
+        '<input name="lockKey" type="text" data-i18n=' +
487 487
         '"[placeholder]dialog.password" placeholder="' +
488 488
         APP.translation.translateString("dialog.password") +
489 489
         '" autofocus>';
@@ -492,18 +492,17 @@ function onPasswordReqiured(callback) {
492 492
         true,
493 493
         "dialog.Ok",
494 494
         function (e, v, m, f) {},
495
-        function (event) {
496
-            document.getElementById('lockKey').focus();
497
-        },
495
+        null,
498 496
         function (e, v, m, f) {
499 497
             if (v) {
500
-                var lockKey = document.getElementById('lockKey');
501
-                if (lockKey.value !== null) {
502
-                    Toolbar.setSharedKey(lockKey.value);
503
-                    callback(lockKey.value);
498
+                var lockKey = f.lockKey;
499
+                if (lockKey) {
500
+                    Toolbar.setSharedKey(lockKey);
501
+                    callback(lockKey);
504 502
                 }
505 503
             }
506
-        }
504
+        },
505
+        ':input:first'
507 506
     );
508 507
 }
509 508
 function onMucEntered(jid, id, displayName) {
@@ -633,9 +632,9 @@ UI.showLoginPopup = function(callback)
633 632
     message += APP.translation.translateString(
634 633
         "dialog.passwordRequired");
635 634
     message += '</h2>' +
636
-        '<input id="passwordrequired.username" type="text" ' +
635
+        '<input name="username" type="text" ' +
637 636
         'placeholder="user@domain.net" autofocus>' +
638
-        '<input id="passwordrequired.password" ' +
637
+        '<input name="password" ' +
639 638
         'type="password" data-i18n="[placeholder]dialog.userPassword"' +
640 639
         ' placeholder="user password">';
641 640
     UI.messageHandler.openTwoButtonDialog(null, null, null, message,
@@ -643,17 +642,13 @@ UI.showLoginPopup = function(callback)
643 642
         "dialog.Ok",
644 643
         function (e, v, m, f) {
645 644
             if (v) {
646
-                var username = document.getElementById('passwordrequired.username');
647
-                var password = document.getElementById('passwordrequired.password');
648
-
649
-                if (username.value !== null && password.value != null) {
650
-                    callback(username.value, password.value);
645
+                if (f.username !== null && f.password != null) {
646
+                    callback(f.username, f.password);
651 647
                 }
652 648
             }
653 649
         },
654
-        function (event) {
655
-            document.getElementById('passwordrequired.username').focus();
656
-        }
650
+        null, null, ':input:first'
651
+
657 652
     );
658 653
 }
659 654
 

+ 10
- 8
modules/UI/prezi/Prezi.js Parādīt failu

@@ -82,23 +82,24 @@ var Prezi = {
82 82
             var openPreziState = {
83 83
                 state0: {
84 84
                     html:   '<h2>' + html + '</h2>' +
85
-                            '<input id="preziUrl" type="text" ' +
85
+                            '<input name="preziUrl" type="text" ' +
86 86
                             'data-i18n="[placeholder]defaultPreziLink" data-i18n-options=\'' +
87 87
                             JSON.stringify({"url": "http://prezi.com/wz7vhjycl7e6/my-prezi"}) +
88 88
                             '\' placeholder="' + defaultUrl + '" autofocus>',
89 89
                     persistent: false,
90 90
                     buttons: buttons,
91
-                    defaultButton: 1,
92
-                    submit: function(e,v,m,f){
91
+                    focus: ':input:first',
92
+                    defaultButton: 0,
93
+                    submit: function (e, v, m, f) {
93 94
                         e.preventDefault();
94 95
                         if(v)
95 96
                         {
96
-                            var preziUrl = document.getElementById('preziUrl');
97
+                            var preziUrl = f.preziUrl;
97 98
 
98
-                            if (preziUrl.value)
99
+                            if (preziUrl)
99 100
                             {
100 101
                                 var urlValue
101
-                                    = encodeURI(UIUtil.escapeHtml(preziUrl.value));
102
+                                    = encodeURI(UIUtil.escapeHtml(preziUrl));
102 103
 
103 104
                                 if (urlValue.indexOf('http://prezi.com/') != 0
104 105
                                     && urlValue.indexOf('https://prezi.com/') != 0)
@@ -130,10 +131,11 @@ var Prezi = {
130 131
                             linkError,
131 132
                     persistent: false,
132 133
                     buttons: buttons1,
134
+                    focus: ':input:first',
133 135
                     defaultButton: 1,
134
-                    submit:function(e,v,m,f) {
136
+                    submit: function (e, v, m, f) {
135 137
                         e.preventDefault();
136
-                        if(v==0)
138
+                        if (v === 0)
137 139
                             $.prompt.close();
138 140
                         else
139 141
                             $.prompt.goToState('state0');

+ 22
- 25
modules/UI/toolbars/Toolbar.js Parādīt failu

@@ -131,25 +131,23 @@ function toggleRecording() {
131 131
         var token = APP.translation.translateString("dialog.token");
132 132
         APP.UI.messageHandler.openTwoButtonDialog(null, null, null,
133 133
                 '<h2>' + msg + '</h2>' +
134
-                '<input id="recordingToken" type="text" ' +
134
+                '<input name="recordingToken" type="text" ' +
135 135
                 ' data-i18n="[placeholder]dialog.token" ' +
136 136
                 'placeholder="' + token + '" autofocus>',
137 137
             false,
138 138
             "dialog.Save",
139 139
             function (e, v, m, f) {
140 140
                 if (v) {
141
-                    var token = document.getElementById('recordingToken');
141
+                    var token = f.recordingToken;
142 142
 
143
-                    if (token.value) {
144
-                        callback(UIUtil.escapeHtml(token.value));
143
+                    if (token) {
144
+                        callback(UIUtil.escapeHtml(token));
145 145
                     }
146 146
                 }
147 147
             },
148
-            function (event) {
149
-                document.getElementById('recordingToken').focus();
150
-            },
151
-            function () {
152
-            }
148
+            null,
149
+            function () { },
150
+            ':input:first'
153 151
         );
154 152
     }, Toolbar.setRecordingButtonState, Toolbar.setRecordingButtonState);
155 153
 }
@@ -232,22 +230,21 @@ function callSipButtonClicked()
232 230
         "dialog.sipMsg");
233 231
     messageHandler.openTwoButtonDialog(null, null, null,
234 232
         '<h2>' + sipMsg + '</h2>' +
235
-        '<input id="sipNumber" type="text"' +
233
+        '<input name="sipNumber" type="text"' +
236 234
         ' value="' + defaultNumber + '" autofocus>',
237 235
         false,
238 236
         "dialog.Dial",
239 237
         function (e, v, m, f) {
240 238
             if (v) {
241
-                var numberInput = document.getElementById('sipNumber');
242
-                if (numberInput.value) {
243
-                    APP.xmpp.dial(numberInput.value, 'fromnumber',
244
-                        UI.getRoomName(), sharedKey);
239
+                var numberInput = f.sipNumber;
240
+                if (numberInput) {
241
+                    APP.xmpp.dial(
242
+                        numberInput, 'fromnumber', UI.getRoomName(), sharedKey);
245 243
                 }
246 244
             }
247 245
         },
248
-        function (event) {
249
-            document.getElementById('sipNumber').focus();
250
-        }
246
+        null,
247
+        ':input:first'
251 248
     );
252 249
 }
253 250
 
@@ -377,24 +374,23 @@ var Toolbar = (function (my) {
377 374
                     "dialog.yourPassword");
378 375
                 messageHandler.openTwoButtonDialog(null, null, null,
379 376
                     '<h2>' + msg + '</h2>' +
380
-                        '<input id="lockKey" type="text"' +
377
+                        '<input name="lockKey" type="text"' +
381 378
                         ' data-i18n="[placeholder]dialog.yourPassword" ' +
382 379
                         'placeholder="' + yourPassword + '" autofocus>',
383 380
                     false,
384 381
                     "dialog.Save",
385
-                    function (e, v) {
382
+                    function (e, v, m, f) {
386 383
                         if (v) {
387
-                            var lockKey = document.getElementById('lockKey');
384
+                            var lockKey = f.lockKey;
388 385
 
389
-                            if (lockKey.value) {
390
-                                Toolbar.setSharedKey(UIUtil.escapeHtml(lockKey.value));
386
+                            if (lockKey) {
387
+                                Toolbar.setSharedKey(
388
+                                    UIUtil.escapeHtml(lockKey));
391 389
                                 lockRoom(true);
392 390
                             }
393 391
                         }
394 392
                     },
395
-                    function () {
396
-                        document.getElementById('lockKey').focus();
397
-                    }
393
+                    null, null, 'input:first'
398 394
                 );
399 395
             }
400 396
         }
@@ -438,6 +434,7 @@ var Toolbar = (function (my) {
438 434
 
439 435
     /**
440 436
      * Opens the settings dialog.
437
+     * FIXME: not used ?
441 438
      */
442 439
     my.openSettingsDialog = function () {
443 440
         var settings1 = APP.translation.generateTranslatonHTML(

+ 7
- 2
modules/UI/util/MessageHandler.js Parādīt failu

@@ -32,10 +32,14 @@ var messageHandler = (function(my) {
32 32
      * @param submitFunction function to be called on submit
33 33
      * @param loadedFunction function to be called after the prompt is fully loaded
34 34
      * @param closeFunction function to be called after the prompt is closed
35
+     * @param focus optional focus selector or button index to be focused after
36
+     *        the dialog is opened
37
+     * @param defaultButton index of default button which will be activated when
38
+     *        the user press 'enter'. Indexed from 0.
35 39
      */
36 40
     my.openTwoButtonDialog = function(titleKey, titleString, msgKey, msgString,
37 41
         persistent, leftButtonKey, submitFunction, loadedFunction,
38
-        closeFunction)
42
+        closeFunction, focus, defaultButton)
39 43
     {
40 44
         var buttons = [];
41 45
 
@@ -58,7 +62,8 @@ var messageHandler = (function(my) {
58 62
             title: title,
59 63
             persistent: false,
60 64
             buttons: buttons,
61
-            defaultButton: 1,
65
+            defaultButton: defaultButton,
66
+            focus: focus,
62 67
             loaded: loadedFunction,
63 68
             submit: submitFunction,
64 69
             close: closeFunction

Notiek ielāde…
Atcelt
Saglabāt