Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
fef3fd87
Commit
fef3fd87
authored
Dec 14, 2012
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1154 from MITx/feature/dhm/cms-settings
Fixed 2nd fn which had regex infinite loop
parents
d965221e
b9d9c7b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
cms/static/js/models/settings/course_details.js
+7
-5
No files found.
cms/static/js/models/settings/course_details.js
View file @
fef3fd87
...
...
@@ -61,7 +61,7 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
// GET "http://gdata.youtube.com/feeds/api/videos/" + videokey
}
if
(
!
_
.
isEmpty
(
vid_errors
))
{
errors
.
intro_video
=
vid_errors
.
join
(
'
/n
'
);
errors
.
intro_video
=
vid_errors
.
join
(
'
'
);
}
}
if
(
!
_
.
isEmpty
(
errors
))
return
errors
;
...
...
@@ -76,8 +76,8 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
_videoprefix
:
/
\s
*<video
\s
*youtube="/g
,
// the below is lax to enable validation
_videospeedparse
:
/
[^
:
]
*/g
,
// /\d+\.?\d*(?=:)/g,
_videokeyparse
:
/
([^
,
\/]
+
)
/g
,
_videonosuffix
:
/
[^
\"\/\
>]
+/g
,
_videokeyparse
:
/
([^
,
\/
>
]
+
)
/g
,
_videonosuffix
:
/
[^
"
\/
>
]
+/g
,
_getNextMatch
:
function
(
regex
,
string
,
cursor
)
{
regex
.
lastIndex
=
cursor
;
var
result
=
regex
.
exec
(
string
);
...
...
@@ -113,13 +113,15 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
cursor
=
this
.
_videokeyparse
.
lastIndex
+
1
;
while
(
cursor
<
videostring
.
length
&&
bestspeed
!=
1.0
)
{
parsedspeed
=
this
.
_getNextMatch
(
this
.
_videospeedparse
,
videostring
,
cursor
);
cursor
=
this
.
_videospeedparse
.
lastIndex
+
1
;
if
(
parsedspeed
)
cursor
=
this
.
_videospeedparse
.
lastIndex
+
1
;
else
break
;
if
(
Math
.
abs
(
Number
(
parsedspeed
)
-
1.0
)
<
Math
.
abs
(
bestspeed
-
1.0
))
{
bestspeed
=
Number
(
parsedspeed
);
bestkey
=
this
.
_getNextMatch
(
this
.
_videokeyparse
,
videostring
,
cursor
);
}
else
this
.
_getNextMatch
(
this
.
_videokeyparse
,
videostring
,
cursor
);
cursor
=
this
.
_videokeyparse
.
lastIndex
+
1
;
if
(
this
.
_videokeyparse
.
lastIndex
>
cursor
)
cursor
=
this
.
_videokeyparse
.
lastIndex
+
1
;
else
cursor
++
;
}
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment