Bläddra i källkod

Consistency

Be consistent about formatting within 1 and the same file.
master
Lyubomir Marinov 8 år sedan
förälder
incheckning
8687b69167
1 ändrade filer med 17 tillägg och 17 borttagningar
  1. 17
    17
      modules/UI/util/UIUtil.js

+ 17
- 17
modules/UI/util/UIUtil.js Visa fil

54
     /**
54
     /**
55
      * Returns the available video width.
55
      * Returns the available video width.
56
      */
56
      */
57
-    getAvailableVideoWidth: function () {
57
+    getAvailableVideoWidth() {
58
         return window.innerWidth;
58
         return window.innerWidth;
59
     },
59
     },
60
 
60
 
70
      *
70
      *
71
      * @param el the element
71
      * @param el the element
72
      */
72
      */
73
-    getTextWidth: function (el) {
73
+    getTextWidth(el) {
74
         return (el.clientWidth + 1);
74
         return (el.clientWidth + 1);
75
     },
75
     },
76
 
76
 
79
      *
79
      *
80
      * @param el the element
80
      * @param el the element
81
      */
81
      */
82
-    getTextHeight: function (el) {
82
+    getTextHeight(el) {
83
         return (el.clientHeight + 1);
83
         return (el.clientHeight + 1);
84
     },
84
     },
85
 
85
 
88
      *
88
      *
89
      * @param id the identifier of the audio element.
89
      * @param id the identifier of the audio element.
90
      */
90
      */
91
-    playSoundNotification: function (id) {
91
+    playSoundNotification(id) {
92
         document.getElementById(id).play();
92
         document.getElementById(id).play();
93
     },
93
     },
94
 
94
 
95
     /**
95
     /**
96
      * Escapes the given text.
96
      * Escapes the given text.
97
      */
97
      */
98
-    escapeHtml: function (unsafeText) {
98
+    escapeHtml(unsafeText) {
99
         return $('<div/>').text(unsafeText).html();
99
         return $('<div/>').text(unsafeText).html();
100
     },
100
     },
101
 
101
 
105
      * @param {string} safe string which contains escaped html
105
      * @param {string} safe string which contains escaped html
106
      * @returns {string} unescaped html string.
106
      * @returns {string} unescaped html string.
107
      */
107
      */
108
-    unescapeHtml: function (safe) {
108
+    unescapeHtml(safe) {
109
         return $('<div />').html(safe).text();
109
         return $('<div />').html(safe).text();
110
     },
110
     },
111
 
111
 
112
-    imageToGrayScale: function (canvas) {
112
+    imageToGrayScale(canvas) {
113
         var context = canvas.getContext('2d');
113
         var context = canvas.getContext('2d');
114
         var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
114
         var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
115
         var pixels  = imgData.data;
115
         var pixels  = imgData.data;
156
      * @param key the tooltip data-i18n key
156
      * @param key the tooltip data-i18n key
157
      * @param position the position of the tooltip in relation to the element
157
      * @param position the position of the tooltip in relation to the element
158
      */
158
      */
159
-    setTooltip: function (element, key, position) {
159
+    setTooltip(element, key, position) {
160
         if (element !== null) {
160
         if (element !== null) {
161
             element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]);
161
             element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]);
162
             element.setAttribute('data-i18n', '[content]' + key);
162
             element.setAttribute('data-i18n', '[content]' + key);
170
      *
170
      *
171
      * @param element the element to remove the tooltip from
171
      * @param element the element to remove the tooltip from
172
      */
172
      */
173
-    removeTooltip: function (element) {
173
+    removeTooltip(element) {
174
         element.removeAttribute('data-tooltip', '');
174
         element.removeAttribute('data-tooltip', '');
175
         element.removeAttribute('data-i18n','');
175
         element.removeAttribute('data-i18n','');
176
         element.removeAttribute('content','');
176
         element.removeAttribute('content','');
183
      * @returns {string|*}
183
      * @returns {string|*}
184
      * @private
184
      * @private
185
      */
185
      */
186
-    _getTooltipText: function (element) {
186
+    _getTooltipText(element) {
187
         let title = element.getAttribute('content');
187
         let title = element.getAttribute('content');
188
         let shortcut = element.getAttribute('shortcut');
188
         let shortcut = element.getAttribute('shortcut');
189
         if(shortcut) {
189
         if(shortcut) {
198
      * @param container the container to which new child element will be added
198
      * @param container the container to which new child element will be added
199
      * @param newChild the new element that will be inserted into the container
199
      * @param newChild the new element that will be inserted into the container
200
      */
200
      */
201
-    prependChild: function (container, newChild) {
201
+    prependChild(container, newChild) {
202
         var firstChild = container.childNodes[0];
202
         var firstChild = container.childNodes[0];
203
         if (firstChild) {
203
         if (firstChild) {
204
             container.insertBefore(newChild, firstChild);
204
             container.insertBefore(newChild, firstChild);
214
      * @returns {boolean} {true} to indicate that the given toolbar button
214
      * @returns {boolean} {true} to indicate that the given toolbar button
215
      * is enabled, {false} - otherwise
215
      * is enabled, {false} - otherwise
216
      */
216
      */
217
-    isButtonEnabled: function (name) {
217
+    isButtonEnabled(name) {
218
         return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
218
         return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
219
                 || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
219
                 || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
220
     },
220
     },
226
      * @returns {boolean} {true} to indicate that the given setting section
226
      * @returns {boolean} {true} to indicate that the given setting section
227
      * is enabled, {false} - otherwise
227
      * is enabled, {false} - otherwise
228
      */
228
      */
229
-    isSettingEnabled: function (name) {
229
+    isSettingEnabled(name) {
230
         return interfaceConfig.SETTINGS_SECTIONS.indexOf(name) !== -1;
230
         return interfaceConfig.SETTINGS_SECTIONS.indexOf(name) !== -1;
231
     },
231
     },
232
 
232
 
235
      *
235
      *
236
      * @returns {boolean}
236
      * @returns {boolean}
237
      */
237
      */
238
-    isAuthenticationEnabled: function() {
238
+    isAuthenticationEnabled() {
239
         return interfaceConfig.AUTHENTICATION_ENABLE;
239
         return interfaceConfig.AUTHENTICATION_ENABLE;
240
     },
240
     },
241
 
241
 
303
         }
303
         }
304
     },
304
     },
305
 
305
 
306
-    hideDisabledButtons: function (mappings) {
306
+    hideDisabledButtons(mappings) {
307
         var selector = Object.keys(mappings)
307
         var selector = Object.keys(mappings)
308
           .map(function (buttonName) {
308
           .map(function (buttonName) {
309
                 return UIUtil.isButtonEnabled(buttonName)
309
                 return UIUtil.isButtonEnabled(buttonName)
313
         $(selector).hide();
313
         $(selector).hide();
314
     },
314
     },
315
 
315
 
316
-    redirect (url) {
316
+    redirect(url) {
317
          window.location.href = url;
317
          window.location.href = url;
318
     },
318
     },
319
 
319
 
368
       * @param {Object} attrs object with properties
368
       * @param {Object} attrs object with properties
369
       * @returns {String} string of html element attributes
369
       * @returns {String} string of html element attributes
370
       */
370
       */
371
-     attrsToString: function (attrs) {
371
+     attrsToString(attrs) {
372
          return Object.keys(attrs).map(
372
          return Object.keys(attrs).map(
373
              key => ` ${key}="${attrs[key]}"`
373
              key => ` ${key}="${attrs[key]}"`
374
          ).join(' ');
374
          ).join(' ');

Laddar…
Avbryt
Spara