Files
edx-platform/lms/static/coffee/src/main.coffee
Daniel Friedman 15f148141f Upgrade jQuery 1.7.2 to 2.2.0
FEDX-25
2016-05-24 16:52:50 -04:00

39 lines
972 B
CoffeeScript

AjaxPrefix.addAjaxPrefix(jQuery, -> $("meta[name='path_prefix']").attr('content'))
$ ->
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
window.onTouchBasedDevice = ->
navigator.userAgent.match /iPhone|iPod|iPad|Android/i
$('body').addClass 'touch-based-device' if onTouchBasedDevice()
# $("a[rel*=leanModal]").leanModal()
$('#csrfmiddlewaretoken').attr 'value', $.cookie('csrftoken')
new Calculator
new FeedbackForm
if $('body').hasClass('courseware')
Courseware.start()
window.postJSON = (url, data, callback) ->
$.postWithPrefix url, data, callback
$('#login').click ->
$('#login_form input[name="email"]').focus()
false
$('#signup').click ->
$('#signup-modal input[name="email"]').focus()
false
# fix for ie
if !Array::indexOf
Array::indexOf = (obj, start = 0) ->
for ele, i in this[start..]
if ele is obj
return i + start
return -1