Преглед изворни кода

Adopts Prezi URL check to match default share links.

master
paweldomas пре 11 година
родитељ
комит
2cbdc43e78
2 измењених фајлова са 11 додато и 12 уклоњено
  1. 11
    1
      prezi.js
  2. 0
    11
      util.js

+ 11
- 1
prezi.js Прегледај датотеку

@@ -112,7 +112,7 @@ var Prezi = (function (my) {
112 112
                             else {
113 113
                                 var presIdTmp = urlValue.substring(
114 114
                                         urlValue.indexOf("prezi.com/") + 10);
115
-                                if (!Util.isAlphanumeric(presIdTmp)
115
+                                if (!isAlphanumeric(presIdTmp)
116 116
                                         || presIdTmp.indexOf('/') < 2) {
117 117
                                     $.prompt.goToState('state1');
118 118
                                     return false;
@@ -258,6 +258,16 @@ var Prezi = (function (my) {
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 272
      * Returns the presentation id from the given url.
263 273
      */

+ 0
- 11
util.js Прегледај датотеку

@@ -46,17 +46,6 @@ var Util = (function (my) {
46 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 50
      * Returns the available video width.
62 51
      */

Loading…
Откажи
Сачувај