Selaa lähdekoodia

Adopts Prezi URL check to match default share links.

master
paweldomas 11 vuotta sitten
vanhempi
commit
2cbdc43e78
2 muutettua tiedostoa jossa 11 lisäystä ja 12 poistoa
  1. 11
    1
      prezi.js
  2. 0
    11
      util.js

+ 11
- 1
prezi.js Näytä tiedosto

112
                             else {
112
                             else {
113
                                 var presIdTmp = urlValue.substring(
113
                                 var presIdTmp = urlValue.substring(
114
                                         urlValue.indexOf("prezi.com/") + 10);
114
                                         urlValue.indexOf("prezi.com/") + 10);
115
-                                if (!Util.isAlphanumeric(presIdTmp)
115
+                                if (!isAlphanumeric(presIdTmp)
116
                                         || presIdTmp.indexOf('/') < 2) {
116
                                         || presIdTmp.indexOf('/') < 2) {
117
                                     $.prompt.goToState('state1');
117
                                     $.prompt.goToState('state1');
118
                                     return false;
118
                                     return false;
258
         }
258
         }
259
     };
259
     };
260
 
260
 
261
+    /**
262
+     * Indicates if the given string is an alphanumeric string.
263
+     * Note that some special characters are also allowed (-, _ , /, &, ?, =, ;) for the
264
+     * purpose of checking URIs.
265
+     */
266
+    function isAlphanumeric(unsafeText) {
267
+        var regex = /^[a-z0-9-_\/&\?=;]+$/i;
268
+        return regex.test(unsafeText);
269
+    }
270
+
261
     /**
271
     /**
262
      * Returns the presentation id from the given url.
272
      * Returns the presentation id from the given url.
263
      */
273
      */

+ 0
- 11
util.js Näytä tiedosto

46
         return $('<div/>').text(unsafeText).html();
46
         return $('<div/>').text(unsafeText).html();
47
     };
47
     };
48
 
48
 
49
-    /**
50
-     * Indicates if the given string is an alphanumeric string.
51
-     * Note that some special characters are also allowed (-, _ , /) for the
52
-     * purpose of checking URIs. (FIXME: This should maybe moved to another not
53
-     * so generic method in the future.)
54
-     */
55
-    my.isAlphanumeric = function(unsafeText) {
56
-        var regex = /^[a-z0-9-_\/]+$/i;
57
-        return regex.test(unsafeText);
58
-    };
59
-
60
     /**
49
     /**
61
      * Returns the available video width.
50
      * Returns the available video width.
62
      */
51
      */

Loading…
Peruuta
Tallenna