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
3a2c527c
Commit
3a2c527c
authored
Mar 13, 2015
by
Usman Khalid
Committed by
Andy Armstrong
Apr 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added javascript library backbone-super.
TNL-1499
parent
970c77ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
0 deletions
+122
-0
lms/static/js/spec/main.js
+4
-0
lms/static/js/vendor/backbone-super.js
+114
-0
lms/static/require-config-lms.js
+4
-0
No files found.
lms/static/js/spec/main.js
View file @
3a2c527c
...
...
@@ -30,6 +30,7 @@
'backbone'
:
'xmodule_js/common_static/js/vendor/backbone-min'
,
'backbone.associations'
:
'xmodule_js/common_static/js/vendor/backbone-associations-min'
,
'backbone.paginator'
:
'xmodule_js/common_static/js/vendor/backbone.paginator.min'
,
"backbone-super"
:
"js/vendor/backbone-super"
,
'tinymce'
:
'xmodule_js/common_static/js/vendor/tinymce/js/tinymce/tinymce.full.min'
,
'jquery.tinymce'
:
'xmodule_js/common_static/js/vendor/tinymce/js/tinymce/jquery.tinymce'
,
'xmodule'
:
'xmodule_js/src/xmodule'
,
...
...
@@ -197,6 +198,9 @@
deps
:
[
'backbone'
],
exports
:
'Backbone.Paginator'
},
"backbone-super"
:
{
deps
:
[
"backbone"
],
},
'youtube'
:
{
exports
:
'YT'
},
...
...
lms/static/js/vendor/backbone-super.js
0 → 100644
View file @
3a2c527c
// https://github.com/lukasolson/backbone-super
// MIT License
// This is a plugin, constructed from parts of Backbone.js and John Resig's inheritance script.
// (See http://backbonejs.org, http://ejohn.org/blog/simple-javascript-inheritance/)
// No credit goes to me as I did absolutely nothing except patch these two together.
(
function
(
root
,
factory
)
{
// Set up Backbone appropriately for the environment. Start with AMD.
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
define
([
'underscore'
,
'backbone'
],
function
(
_
,
Backbone
)
{
// Export global even in AMD case in case this script is loaded with
// others that may still expect a global Backbone.
factory
(
_
,
Backbone
);
});
// Next for Node.js or CommonJS.
}
else
if
(
typeof
exports
!==
'undefined'
&&
typeof
require
===
'function'
)
{
var
_
=
require
(
'underscore'
),
Backbone
=
require
(
'backbone'
);
factory
(
_
,
Backbone
);
// Finally, as a browser global.
}
else
{
factory
(
root
.
_
,
root
.
Backbone
);
}
}(
this
,
function
factory
(
_
,
Backbone
)
{
Backbone
.
Model
.
extend
=
Backbone
.
Collection
.
extend
=
Backbone
.
Router
.
extend
=
Backbone
.
View
.
extend
=
function
(
protoProps
,
classProps
)
{
var
child
=
inherits
(
this
,
protoProps
,
classProps
);
child
.
extend
=
this
.
extend
;
return
child
;
};
var
unImplementedSuper
=
function
(
method
){
throw
"Super does not implement this method: "
+
method
;};
var
fnTest
=
/
\b
_super
\b
/
;
var
makeWrapper
=
function
(
parentProto
,
name
,
fn
)
{
var
wrapper
=
function
()
{
var
tmp
=
this
.
_super
;
// Add a new ._super() method that is the same method
// but on the super-class
this
.
_super
=
parentProto
[
name
]
||
unImplementedSuper
(
name
);
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var
ret
;
try
{
ret
=
fn
.
apply
(
this
,
arguments
);
}
finally
{
this
.
_super
=
tmp
;
}
return
ret
;
};
//we must move properties from old function to new
for
(
var
prop
in
fn
)
{
wrapper
[
prop
]
=
fn
[
prop
];
delete
fn
[
prop
];
}
return
wrapper
;
};
var
ctor
=
function
(){},
inherits
=
function
(
parent
,
protoProps
,
staticProps
)
{
var
child
,
parentProto
=
parent
.
prototype
;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent's constructor.
if
(
protoProps
&&
protoProps
.
hasOwnProperty
(
'constructor'
))
{
child
=
protoProps
.
constructor
;
}
else
{
child
=
function
(){
return
parent
.
apply
(
this
,
arguments
);
};
}
// Inherit class (static) properties from parent.
_
.
extend
(
child
,
parent
,
staticProps
);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
ctor
.
prototype
=
parentProto
;
child
.
prototype
=
new
ctor
();
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if
(
protoProps
)
{
_
.
extend
(
child
.
prototype
,
protoProps
);
// Copy the properties over onto the new prototype
for
(
var
name
in
protoProps
)
{
// Check if we're overwriting an existing function
if
(
typeof
protoProps
[
name
]
==
"function"
&&
fnTest
.
test
(
protoProps
[
name
]))
{
child
.
prototype
[
name
]
=
makeWrapper
(
parentProto
,
name
,
protoProps
[
name
]);
}
}
}
// Add static properties to the constructor function, if supplied.
if
(
staticProps
)
_
.
extend
(
child
,
staticProps
);
// Correctly set child's `prototype.constructor`.
child
.
prototype
.
constructor
=
child
;
// Set a convenience property in case the parent's prototype is needed later.
child
.
__super__
=
parentProto
;
return
child
;
};
return
inherits
;
}));
lms/static/require-config-lms.js
View file @
3a2c527c
...
...
@@ -47,6 +47,7 @@
"annotator_1.2.9"
:
"js/vendor/edxnotes/annotator-full.min"
,
"date"
:
"js/vendor/date"
,
"backbone"
:
"js/vendor/backbone-min"
,
"backbone-super"
:
"js/vendor/backbone-super"
,
"underscore.string"
:
"js/vendor/underscore.string.min"
,
// Files needed by OVA
"annotator"
:
"js/vendor/ova/annotator-full"
,
...
...
@@ -87,6 +88,9 @@
deps
:
[
"underscore"
,
"jquery"
],
exports
:
"Backbone"
},
"backbone-super"
:
{
deps
:
[
"backbone"
],
},
"logger"
:
{
exports
:
"Logger"
},
...
...
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