lib/assets/javascripts/bindings.js.coffee in kolo-0.8.2 vs lib/assets/javascripts/bindings.js.coffee in kolo-0.8.3
- old
+ new
@@ -1,6 +1,6 @@
-ko.bindingHandlers.appearif =
+ko.bindingHandlers.appearif =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
$(element).toggle(value)
update: (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)->
appear = ko.utils.unwrapObservable valueAccessor()
@@ -9,11 +9,11 @@
$(element).fadeIn(duration)
$(element).focus()
else
$(element).fadeOut(duration)
-ko.bindingHandlers.appearifnot =
+ko.bindingHandlers.appearifnot =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
$(element).toggle(!value)
update: (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)->
appear = ko.utils.unwrapObservable valueAccessor()
@@ -22,11 +22,11 @@
$(element).fadeIn(duration)
$(element).focus()
else
$(element).fadeOut(duration)
-ko.bindingHandlers.slidedownif =
+ko.bindingHandlers.slidedownif =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
$(element).toggle(value)
update: (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)->
appear = ko.utils.unwrapObservable valueAccessor()
@@ -35,11 +35,11 @@
$(element).slideDown(duration)
$(element).focus()
else
$(element).slideUp(duration)
-ko.bindingHandlers.slidedownifnot =
+ko.bindingHandlers.slidedownifnot =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
$(element).toggle(!value)
update: (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)->
appear = ko.utils.unwrapObservable valueAccessor()
@@ -48,11 +48,11 @@
$(element).slideDown(duration)
$(element).focus()
else
$(element).slideUp(duration)
-ko.bindingHandlers.slideleftif =
+ko.bindingHandlers.slideleftif =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
if !value
$(element).hide()
$(element).transition({ x: '10000px' }, 1)
@@ -69,11 +69,11 @@
else
$(element).transition({ x: '10000px' }, duration, ->
$(element).hide()
)
-ko.bindingHandlers.slideleftifnot =
+ko.bindingHandlers.slideleftifnot =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
if value
$(element).hide()
$(element).transition({ x: '10000px' }, 1)
@@ -90,11 +90,11 @@
else
$(element).transition({ x: '10000px' }, duration, ->
$(element).hide()
)
-ko.bindingHandlers.sliderightif =
+ko.bindingHandlers.sliderightif =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
if !value
$(element).hide()
$(element).transition({ x: '-10000px' }, 1)
@@ -111,11 +111,11 @@
else
$(element).transition({ x: '-10000px' }, duration, ->
$(element).hide()
)
-ko.bindingHandlers.sliderightifnot =
+ko.bindingHandlers.sliderightifnot =
init: (element, valueAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
if value
$(element).hide()
$(element).transition({ x: '-10000px' }, 1)
@@ -132,35 +132,35 @@
else
$(element).transition({ x: '-10000px' }, duration, ->
$(element).hide()
)
-ko.bindingHandlers.swipeleft =
+ko.bindingHandlers.swipeleft =
init: (element, valueAccessor)->
- Hammer(element).on 'swipeleft', (event)->
+ Hammer(element).on 'swipeleft', (event)->
value = valueAccessor()
value(event)
-ko.bindingHandlers.swiperight =
+ko.bindingHandlers.swiperight =
init: (element, valueAccessor)->
- Hammer(element).on 'swiperight', (event)->
+ Hammer(element).on 'swiperight', (event)->
value = valueAccessor()
value(event)
-ko.bindingHandlers.swipeup =
+ko.bindingHandlers.swipeup =
init: (element, valueAccessor)->
- Hammer(element).on 'swipeup', (event)->
+ Hammer(element).on 'swipeup', (event)->
value = valueAccessor()
value(event)
-ko.bindingHandlers.swipedown =
+ko.bindingHandlers.swipedown =
init: (element, valueAccessor)->
- Hammer(element).on 'swipedown', (event)->
+ Hammer(element).on 'swipedown', (event)->
value = valueAccessor()
value(event)
-ko.bindingHandlers.fileupload =
+ko.bindingHandlers.fileupload =
update: (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)->
options = ko.utils.unwrapObservable valueAccessor()
property = ko.utils.unwrapObservable options.property
parameter = ko.utils.unwrapObservable options.parameter
onStartUpload = ko.utils.unwrapObservable options.onStartUpload
@@ -198,21 +198,21 @@
file = event.target.files[0]
uploadFile file
return true
-ko.bindingHandlers.wysiwyg =
+ko.bindingHandlers.wysiwyg =
init: (element, valueAccessor, allBindingsAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
$(element).attr('id', "ckeditor-#{Math.floor((Math.random() * 100000) + 10000)}") unless $(element).attr('id')?
editor = CKEDITOR.replace element, { allowedContent: true }
document.recalc() if document.recalc?
editor.on 'key', (evt)->
keyCode = evt.data.keyCode
return true if (keyCode == 46 || keyCode == 8 || keyCode == 37 || keyCode == 38 || keyCode == 39 || keyCode == 40) # let BS DEL and arrow keys through no matter what
- limit = 4096
+ limit = 8192
str = evt.editor.getData()
return false if str.length >= limit
return true
editor.on 'change', (evt)->
@@ -228,11 +228,11 @@
value = ko.utils.unwrapObservable valueAccessor()
CKEDITOR.instances[id].setData value
ko.bindingHandlers.value.update element, valueAccessor
$(element).attr('data-edit-in-progress', 'false')
-ko.bindingHandlers.date =
+ko.bindingHandlers.date =
init: (element, valueAccessor, allBindingsAccessor)->
options = allBindingsAccessor().datepickerOptions || {}
options.dateFormat ||= 'yy-mm-dd'
$(element).datepicker(options)
@@ -250,11 +250,11 @@
parsed = $.datepicker.parseDate 'yy-mm-dd', value if value?
catch
parsed = value
$(element).datepicker('setDate', parsed)
-ko.bindingHandlers.slider =
+ko.bindingHandlers.slider =
init: (element, valueAccessor, allBindingsAccessor)->
options = allBindingsAccessor().sliderOptions || {}
options.change = (evt, ui)=>
observable = valueAccessor()
@@ -279,15 +279,14 @@
$(element).attr 'data-edit-in-progress', 'true'
observable = valueAccessor()
newValue = $(element).val()
observable newValue
$(element).attr 'data-edit-in-progress', ''
-
+
ko.utils.domNodeDisposal.addDisposeCallback element, =>
$(element).wysihtml5('destroy')
update: (element, valueAccessor)->
return if $(element).attr('data-edit-in-progress') == 'true'
value = ko.utils.unwrapObservable valueAccessor()
$(element).data('wysihtml5').editor.setValue value
ko.bindingHandlers.value.update element, valueAccessor
-