Drop remaining coffee use
This basically commits the transpiled CoffeeScript JS (with minor cleanup) and removes coffee build support. A tiny amount of support for xblocks exists, because external users may have xblocks with coffee. But no coffee in our tree anyway.
This commit is contained in:
committed by
Michael Terry
parent
2abbd1eb83
commit
a34c8c8233
@@ -1,97 +1,168 @@
|
||||
class StudentNotes
|
||||
_debug: false
|
||||
// Once generated by CoffeeScript 1.9.3, but now lives as pure JS
|
||||
/* eslint-disable */
|
||||
(function() {
|
||||
var StudentNotes,
|
||||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
targets: [] # holds elements with annotator() instances
|
||||
StudentNotes = (function() {
|
||||
StudentNotes.prototype._debug = false;
|
||||
|
||||
# Adds a listener for "notes" events that may bubble up from descendants.
|
||||
constructor: ($, el) ->
|
||||
console.log 'student notes init', arguments, this if @_debug
|
||||
|
||||
if not $(el).data('notes-instance')
|
||||
events = 'notes:init': @onInitNotes
|
||||
$(el).delegate('*', events)
|
||||
$(el).data('notes-instance', @)
|
||||
/*
|
||||
holds elements with annotator() instances
|
||||
*/
|
||||
|
||||
# Initializes annotations on a container element in response to an init event.
|
||||
onInitNotes: (event, uri=null, storage_url=null, token=null) =>
|
||||
event.stopPropagation()
|
||||
StudentNotes.prototype.targets = [];
|
||||
|
||||
found = @targets.some (target) -> target is event.target
|
||||
|
||||
# Get uri
|
||||
unless uri.substring(0, 4) is "http"
|
||||
uri_root = (window.location.href.split(/#|\?/).shift() or "")
|
||||
uri = uri_root + uri.substring(1)
|
||||
parts = window.location.href.split("/")
|
||||
courseid = parts[4] + "/" + parts[5] + "/" + parts[6]
|
||||
/*
|
||||
Adds a listener for "notes" events that may bubble up from descendants.
|
||||
*/
|
||||
|
||||
# Get id and name user
|
||||
idUdiv = $(event.target).parent().find(".idU")[0]
|
||||
idDUdiv = $(event.target).parent().find(".idDU")[0]
|
||||
idUdiv = (if typeof idUdiv isnt "undefined" then idUdiv.innerHTML else "")
|
||||
idDUdiv = (if typeof idDUdiv isnt "undefined" then idDUdiv.innerHTML else "")
|
||||
|
||||
options =
|
||||
optionsAnnotator:
|
||||
permissions:
|
||||
user:
|
||||
id: idUdiv
|
||||
name: idDUdiv
|
||||
function StudentNotes($, el) {
|
||||
this.onInitNotes = bind(this.onInitNotes, this);
|
||||
var events;
|
||||
if (this._debug) {
|
||||
console.log('student notes init', arguments, this);
|
||||
}
|
||||
if (!$(el).data('notes-instance')) {
|
||||
events = {
|
||||
'notes:init': this.onInitNotes
|
||||
};
|
||||
$(el).delegate('*', events);
|
||||
$(el).data('notes-instance', this);
|
||||
}
|
||||
}
|
||||
|
||||
userString: (user) ->
|
||||
return user.name if user and user.name
|
||||
user
|
||||
|
||||
userId: (user) ->
|
||||
return user.id if user and user.id
|
||||
user
|
||||
auth:
|
||||
token: token
|
||||
/*
|
||||
Initializes annotations on a container element in response to an init event.
|
||||
*/
|
||||
|
||||
store:
|
||||
prefix: storage_url
|
||||
StudentNotes.prototype.onInitNotes = function(event, uri, storage_url, token) {
|
||||
var courseid, found, idDUdiv, idUdiv, options, ova, parts, uri_root;
|
||||
if (uri == null) {
|
||||
uri = null;
|
||||
}
|
||||
if (storage_url == null) {
|
||||
storage_url = null;
|
||||
}
|
||||
if (token == null) {
|
||||
token = null;
|
||||
}
|
||||
event.stopPropagation();
|
||||
found = this.targets.some(function(target) {
|
||||
return target === event.target;
|
||||
});
|
||||
|
||||
annotationData: uri:uri
|
||||
/*
|
||||
Get uri
|
||||
*/
|
||||
if (uri.substring(0, 4) !== "http") {
|
||||
uri_root = window.location.href.split(/#|\?/).shift() || "";
|
||||
uri = uri_root + uri.substring(1);
|
||||
}
|
||||
parts = window.location.href.split("/");
|
||||
courseid = parts[4] + "/" + parts[5] + "/" + parts[6];
|
||||
|
||||
urls:
|
||||
create: '/create',
|
||||
read: '/read/:id',
|
||||
update: '/update/:id',
|
||||
destroy: '/delete/:id',
|
||||
search: '/search'
|
||||
/*
|
||||
Get id and name user
|
||||
*/
|
||||
idUdiv = $(event.target).parent().find(".idU")[0];
|
||||
idDUdiv = $(event.target).parent().find(".idDU")[0];
|
||||
idUdiv = (typeof idUdiv !== "undefined" ? idUdiv.innerHTML : "");
|
||||
idDUdiv = (typeof idDUdiv !== "undefined" ? idDUdiv.innerHTML : "");
|
||||
options = {
|
||||
optionsAnnotator: {
|
||||
permissions: {
|
||||
user: {
|
||||
id: idUdiv,
|
||||
name: idDUdiv
|
||||
},
|
||||
userString: function(user) {
|
||||
if (user && user.name) {
|
||||
return user.name;
|
||||
}
|
||||
return user;
|
||||
},
|
||||
userId: function(user) {
|
||||
if (user && user.id) {
|
||||
return user.id;
|
||||
}
|
||||
return user;
|
||||
}
|
||||
},
|
||||
auth: {
|
||||
token: token
|
||||
},
|
||||
store: {
|
||||
prefix: storage_url,
|
||||
annotationData: {
|
||||
uri: uri
|
||||
},
|
||||
urls: {
|
||||
create: '/create',
|
||||
read: '/read/:id',
|
||||
update: '/update/:id',
|
||||
destroy: '/delete/:id',
|
||||
search: '/search'
|
||||
},
|
||||
loadFromSearch: {
|
||||
limit: 10000,
|
||||
uri: uri,
|
||||
user: idUdiv
|
||||
}
|
||||
}
|
||||
},
|
||||
optionsVideoJS: {
|
||||
techOrder: ["html5", "flash", "youtube"],
|
||||
customControlsOnMobile: true
|
||||
},
|
||||
optionsOVA: {
|
||||
posBigNew: 'none',
|
||||
NumAnnotations: 20
|
||||
},
|
||||
optionsRichText: {
|
||||
tinymce: {
|
||||
selector: "li.annotator-item textarea",
|
||||
plugins: "media image insertdatetime link code",
|
||||
menubar: false,
|
||||
toolbar_items_size: 'small',
|
||||
extended_valid_elements: "iframe[src|frameborder|style|scrolling|class|width|height|name|align|id]",
|
||||
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media rubric | code "
|
||||
}
|
||||
}
|
||||
};
|
||||
if (found) {
|
||||
if (Annotator._instances.length !== 0) {
|
||||
$(event.target).annotator("destroy");
|
||||
}
|
||||
return ova = new OpenVideoAnnotation.Annotator($(event.target), options);
|
||||
} else {
|
||||
if (event.target.id === "annotator-viewer") {
|
||||
return ova = new OpenVideoAnnotation.Annotator($(event.target), options);
|
||||
} else {
|
||||
return this.targets.push(event.target);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
loadFromSearch:
|
||||
limit:10000
|
||||
uri: uri
|
||||
user:idUdiv
|
||||
|
||||
optionsVideoJS: techOrder: ["html5","flash","youtube"],customControlsOnMobile: true
|
||||
optionsOVA:
|
||||
posBigNew:'none'
|
||||
NumAnnotations:20
|
||||
optionsRichText:
|
||||
tinymce:
|
||||
selector: "li.annotator-item textarea"
|
||||
plugins: "media image insertdatetime link code"
|
||||
menubar: false
|
||||
toolbar_items_size: 'small'
|
||||
extended_valid_elements : "iframe[src|frameborder|style|scrolling|class|width|height|name|align|id]"
|
||||
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media rubric | code "
|
||||
|
||||
if found
|
||||
$(event.target).annotator "destroy" unless Annotator._instances.length is 0
|
||||
ova = new OpenVideoAnnotation.Annotator($(event.target), options)
|
||||
else
|
||||
if event.target.id is "annotator-viewer"
|
||||
ova = new OpenVideoAnnotation.Annotator($(event.target), options)
|
||||
else
|
||||
@targets.push(event.target)
|
||||
return StudentNotes;
|
||||
|
||||
# Enable notes by default on the document root.
|
||||
# To initialize annotations on a container element in the document:
|
||||
#
|
||||
# $('#myElement').trigger('notes:init');
|
||||
#
|
||||
# Comment this line to disable notes.
|
||||
})();
|
||||
|
||||
$(document).ready ($) -> new StudentNotes $, @
|
||||
|
||||
/*
|
||||
Enable notes by default on the document root.
|
||||
To initialize annotations on a container element in the document:
|
||||
|
||||
$('#myElement').trigger('notes:init');
|
||||
|
||||
Comment this line to disable notes.
|
||||
*/
|
||||
|
||||
$(document).ready(function($) {
|
||||
return new StudentNotes($, this);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
Reference in New Issue
Block a user