card-mod-script 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/db/migrate_core_cards/20200804112348_add_mod_script_assets_type.rb +30 -0
  4. data/file/mod_script_script_decko_machine_output/file.js +2710 -0
  5. data/file/mod_script_script_jquery_machine_output/file.js +12924 -0
  6. data/set/abstract/{script.rb → 00_script.rb} +7 -3
  7. data/set/abstract/01_asset_script.rb +25 -0
  8. data/set/abstract/01_java_script.rb +9 -0
  9. data/set/abstract/02_coffee_script.rb +25 -0
  10. data/set/abstract/03_asset_java_script.rb +4 -0
  11. data/set/abstract/04_asset_coffee_script.rb +4 -0
  12. data/set/abstract/script_asset_list.rb +32 -0
  13. data/set/all/head_javascript.rb +75 -0
  14. data/set/right/script.rb +18 -7
  15. data/set/type/coffee_script.rb +1 -23
  16. data/set/type/java_script.rb +1 -7
  17. data/set/type/local_script_folder_group.rb +2 -0
  18. data/set/type/local_script_manifest_group.rb +2 -0
  19. data/set/type/mod_script_assets.rb +21 -0
  20. metadata +38 -48
  21. data/lib/javascript/decko/autosave.js.coffee +0 -30
  22. data/lib/javascript/decko/bridge.js.coffee +0 -31
  23. data/lib/javascript/decko/card_menu.js.coffee +0 -26
  24. data/lib/javascript/decko/components.js.coffee +0 -51
  25. data/lib/javascript/decko/decko.js.coffee +0 -100
  26. data/lib/javascript/decko/doubleclick.js.coffee +0 -30
  27. data/lib/javascript/decko/editor.js.coffee +0 -55
  28. data/lib/javascript/decko/filter.js.coffee +0 -176
  29. data/lib/javascript/decko/filter_items.js.coffee +0 -128
  30. data/lib/javascript/decko/filter_links.js.coffee +0 -81
  31. data/lib/javascript/decko/follow.js.coffee +0 -22
  32. data/lib/javascript/decko/layout.js.coffee +0 -76
  33. data/lib/javascript/decko/link_editor.js.coffee +0 -61
  34. data/lib/javascript/decko/mod.js.coffee +0 -85
  35. data/lib/javascript/decko/modal.js.coffee +0 -113
  36. data/lib/javascript/decko/name_editor.js.coffee +0 -59
  37. data/lib/javascript/decko/navbox.js.coffee +0 -74
  38. data/lib/javascript/decko/nest_editor.js.coffee +0 -166
  39. data/lib/javascript/decko/nest_editor_name.js.coffee +0 -102
  40. data/lib/javascript/decko/nest_editor_options.js.coffee +0 -93
  41. data/lib/javascript/decko/nest_editor_rules.js.coffee +0 -3
  42. data/lib/javascript/decko/overlay.js.coffee +0 -57
  43. data/lib/javascript/decko/recaptcha.js.coffee +0 -19
  44. data/lib/javascript/decko/selectable_filtered_content.js.coffee +0 -12
  45. data/lib/javascript/decko/slot.js.coffee +0 -178
  46. data/lib/javascript/decko/slot_ready.js.coffee +0 -11
  47. data/lib/javascript/decko/slotter.js.coffee +0 -276
  48. data/lib/javascript/decko/upload.js.coffee +0 -57
  49. data/lib/javascript/jquery-ui.js +0 -10
  50. data/lib/javascript/jquery.autosize.js +0 -274
  51. data/lib/javascript/script_pointer_config.js.coffee +0 -80
  52. data/lib/javascript/script_pointer_list_editor.js.coffee +0 -67
  53. data/set/self/01_script_libraries.rb +0 -1
  54. data/set/self/script_decko.rb +0 -12
  55. data/set/self/script_editors.rb +0 -1
  56. data/set/self/script_jquery.rb +0 -10
  57. data/set/self/script_jquery_helper.rb +0 -14
  58. data/set/self/script_pointer_config.rb +0 -9
@@ -1,30 +0,0 @@
1
- jQuery.fn.extend
2
- autosave: ->
3
- slot = @slot()
4
- return if @attr 'no-autosave'
5
- multi = @closest '.form-group'
6
- if multi[0]
7
- return unless id = multi.data 'cardId'
8
- reportee = ': ' + multi.data 'cardName'
9
- else
10
- id = slot.data 'cardId'
11
- reportee = ''
12
-
13
- return unless id
14
-
15
- # might be better to put this href base in the html
16
- submit_url = decko.path 'update/~' + id
17
- form_data = $('#edit_card_'+id).serializeArray().reduce( ((obj, item) ->
18
- obj[item.name] = item.value
19
- return obj
20
- ), { 'draft' : 'true', 'success[view]' : 'blank'});
21
- $.ajax submit_url, {
22
- data : form_data,
23
- type : 'POST'
24
- }
25
- ##{ 'card[content]' : @val() },
26
-
27
- $(window).ready ->
28
- $('body').on 'change', '.autosave .d0-card-content', ->
29
- content_field = $(this)
30
- setTimeout ( -> content_field.autosave() ), 500
@@ -1,31 +0,0 @@
1
- decko.slotReady (slot, slotter) ->
2
- slot.updateBridge(false, slotter)
3
-
4
- links = slot.find('ul._auto-single-select > li.nav-item > a.nav-link')
5
- if links.length == 1
6
- $(links[0]).click()
7
-
8
- jQuery.fn.extend
9
- # overlayClosed=true means the bridge update was
10
- # triggered by closing an overlay
11
- updateBridge: (overlayClosed=false, slotter) ->
12
- return unless @closest(".bridge").length > 0
13
- if @data("breadcrumb")
14
- @updateBreadcrumb()
15
- else if slotter and $(slotter).data("breadcrumb")
16
- $(slotter).updateBreadcrumb()
17
-
18
- if overlayClosed
19
- $(".bridge-pills > .nav-item > .nav-link.active").removeClass("active")
20
-
21
- updateBreadcrumb: () ->
22
- bc_item = $(".modal-header ._bridge-breadcrumb li:last-child")
23
- bc_item.text(this.data("breadcrumb"))
24
- bc_item.attr("class", "breadcrumb-item active #{this.data('breadcrumb-class')}")
25
-
26
- $(window).ready ->
27
- $('body').on "select2:select", "._close-rule-overlay-on-select", (event) ->
28
- $(".overlay-container > ._overlay.card-slot.overlay_rule-view.RULE").removeOverlay()
29
-
30
- $('body').on "click", "._update-history-pills", (event) ->
31
- $(this).closest(".slotter").data("update-foreign-slot", ".card-slot.history_tab-view")
@@ -1,26 +0,0 @@
1
- decko.isTouchDevice = ->
2
- if 'ontouchstart' of window or window.DocumentTouch and
3
- document instanceof DocumentTouch
4
- return true
5
- else
6
- return detectMobileBrowser()
7
-
8
- # source for this method: detectmobilebrowsers.com
9
- detectMobileBrowser = (userAgent) ->
10
- userAgent = navigator.userAgent or navigator.vendor or window.opera
11
- /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent) or /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4))
12
-
13
- decko.slotReady (slot) ->
14
- if decko.isTouchDevice()
15
- slot.find('._show-on-hover').removeClass('_show-on-hover')
16
-
17
- $(window).ready ->
18
- $('body').on 'show.bs.popover', '._card-menu-popover', () ->
19
- $(this).closest(".card-menu._show-on-hover")
20
- .removeClass("_show-on-hover")
21
- .addClass("_show-on-hover-disabled")
22
-
23
- $('body').on 'hide.bs.popover', '._card-menu-popover', () ->
24
- $(this).closest(".card-menu._show-on-hover-disabled")
25
- .removeClass("_show-on-hover-disabled")
26
- .addClass("_show-on-hover")
@@ -1,51 +0,0 @@
1
- decko.slotReady (slot) ->
2
- $('[data-toggle="popover"]').popover(html: true)
3
-
4
- $('.colorpicker-component').colorpicker()
5
-
6
- submitAfterTyping = null
7
-
8
- $(window).ready ->
9
- $('body').on 'show.bs.tab', 'a.load[data-toggle="tab"][data-url]', (e) ->
10
- tab_id = $(e.target).attr('href')
11
- url = $(e.target).data('url')
12
- $(e.target).removeClass('load')
13
- $.ajax
14
- url: url
15
- type: 'GET'
16
- success: (html) ->
17
- $(tab_id).append(html)
18
- decko.contentLoaded($(tab_id), $(this))
19
-
20
- $('body').on "input", "._submit-after-typing", (event) ->
21
- form = $(event.target).closest('form')
22
- form.slot().find(".autosubmit-success-notification").remove()
23
- clearTimeout(submitAfterTyping) if submitAfterTyping
24
- submitAfterTyping = setTimeout ->
25
- $(event.target).closest('form').submit()
26
- submitAfterTyping = null
27
- , 1000
28
-
29
- $('body').on "keydown", "._submit-after-typing", (event) ->
30
- if event.which == 13
31
- clearTimeout(submitAfterTyping) if submitAfterTyping
32
- submitAfterTyping = null
33
- $(event.target).closest('form').submit()
34
- false
35
-
36
- $('body').on "change", "._submit-on-change", (event) ->
37
- $(event.target).closest('form').submit()
38
- false
39
-
40
- $('body').on "change", "._edit-item", (event) ->
41
- cb = $(event.target)
42
- if cb.is(":checked")
43
- cb.attr("name", "add_item")
44
- else
45
- cb.attr("name", "drop_item")
46
-
47
- $(event.target).closest('form').submit()
48
- false
49
-
50
-
51
-
@@ -1,100 +0,0 @@
1
- $.extend decko,
2
- # returns absolute path (starting with a slash)
3
- # if rawPath is complete url, this returns the complete url
4
- # if rawPath is relative (no slash), this adds relative root
5
- path: (rawPath) ->
6
- if rawPath.match /^\/|:\/\//
7
- rawPath
8
- else
9
- decko.rootUrl + rawPath
10
-
11
- pingName: (name, success)->
12
- $.getJSON decko.path(''), format: 'json', view: 'status', 'card[name]': name, success
13
-
14
- jQuery.fn.extend {
15
- notify: (message, status) ->
16
- slot = @slot(status)
17
- notice = slot.find '.card-notice'
18
- unless notice[0]
19
- notice = $('<div class="card-notice"></div>')
20
- form = slot.find('.card-form')
21
- if form[0]
22
- $(form[0]).append notice
23
- else
24
- slot.append notice
25
- notice.html message
26
- notice.show 'blind'
27
-
28
- report: (message) ->
29
- report = @slot().find '.card-report'
30
- return false unless report[0]
31
- report.hide()
32
- report.html message
33
- report.show 'drop', 750
34
- setTimeout (->report.hide 'drop', 750), 3000
35
- }
36
-
37
- #~~~~~ ( EVENTS )
38
-
39
- $(window).ready ->
40
- $.ajaxSetup cache: false
41
-
42
- $('body').on 'click', '.submitter', ->
43
- $(this).closest('form').submit()
44
-
45
- $('body').on 'click', 'button.redirecter', ->
46
- window.location = $(this).attr('href')
47
-
48
- $('body').on "change", '.live-type-field', ->
49
- $this = $(this)
50
-
51
- setSlotMode($this)
52
- $this.data 'params', $(this).closest('form').serialize()
53
- $this.data 'url', $(this).attr 'href'
54
-
55
- $('body').on 'change', '.edit-type-field', ->
56
- $(this).closest('form').submit()
57
-
58
- $('body').on 'mouseenter', '[hover_content]', ->
59
- $(this).attr 'hover_restore', $(this).html()
60
- $(this).html $(this).attr( 'hover_content' )
61
- $('body').on 'mouseleave', '[hover_content]', ->
62
- $(this).html $(this).attr( 'hover_restore' )
63
-
64
- $('body').on 'click', '.render-error-link', (event) ->
65
- msg = $(this).closest('.render-error').find '.render-error-message'
66
- msg.show()
67
- # msg.dialog()
68
- event.preventDefault()
69
-
70
- decko.slotReady (slot) ->
71
- slot.find('card-view-placeholder').each ->
72
- $place = $(this)
73
- return if $place.data("loading")
74
-
75
- $place.data "loading", true
76
- $.get $place.data("url"), (data, _status) ->
77
- $place.replaceWith data
78
-
79
- # important: this prevents jquery-mobile from taking over everything
80
- # $( document ).on "mobileinit", ->
81
- # $.extend $.mobile , {
82
- # #autoInitializePage: false
83
- # #ajaxEnabled: false
84
- # }
85
-
86
- setSlotMode = ($el, mode=null) ->
87
- $slotter = $el.closest(".slotter")
88
- if $slotter.length && $slotter.attr('data-slotter-mode')
89
- $slotter.attr 'data-original-slotter-mode', $slotter.attr('slotter-mode')
90
- $slotter.attr 'data-slotter-mode', mode
91
-
92
- snakeCase = (str)->
93
- str.replace /([a-z])([A-Z])/g, (match) -> match[0] + '_' +
94
- match[1].toLowerCase()
95
-
96
- warn = (stuff) -> console.log stuff if console?
97
-
98
-
99
-
100
-
@@ -1,30 +0,0 @@
1
- doubleClickActiveMap = { off: false, on: true, signed_in: decko.currentUserId }
2
-
3
- doubleClickActive = () ->
4
- doubleClickActiveMap[decko.doubleClick]
5
- # else alert "illegal configuration: " + decko.doubleClick
6
-
7
- doubleClickApplies = (el) ->
8
- return false if ['.nodblclick', '.d0-card-header', '.card-editor'].some (klass) ->
9
- el.closest(klass)[0]
10
- # double click inactive inside header, editor, or tag with "nodblclick" class
11
- !el.slot().find('.card-editor')[0]?
12
-
13
-
14
- triggerDoubleClickEditingOn = (el)->
15
- slot = el.slot()
16
- edit_link = decko.slotEditLink(slot)
17
-
18
- if edit_link
19
- edit_link.click()
20
- else
21
- edit_view = decko.slotEditView(slot)
22
- url = decko.path("~#{slot.data('cardId')}?view=#{edit_view}")
23
- slot.reloadSlot url
24
-
25
- $(window).ready ->
26
- if doubleClickActive()
27
- $('body').on 'dblclick', 'div', (_event) ->
28
- if doubleClickApplies $(this)
29
- triggerDoubleClickEditingOn $(this)
30
- false # don't propagate up to next slot
@@ -1,55 +0,0 @@
1
- $.extend decko,
2
- initializeEditors: (range, map) ->
3
- map = decko.editorInitFunctionMap unless map?
4
- $.each map, (selector, fn) ->
5
- $.each range.find(selector), ->
6
- fn.call $(this)
7
-
8
- editorContentFunctionMap: {}
9
-
10
- editorInitFunctionMap:
11
- 'textarea': -> $(this).autosize()
12
- '.file-upload': -> decko.upload_file(this)
13
- '.etherpad-textarea': ->
14
- $(this).closest('form')
15
- .find('.edit-submit-button')
16
- .attr('class', 'etherpad-submit-button')
17
-
18
- addEditor: (selector, init, get_content) ->
19
- decko.editorContentFunctionMap[selector] = get_content
20
- decko.editorInitFunctionMap[selector] = init
21
-
22
- jQuery.fn.extend
23
- setContentFieldsFromMap: (map) ->
24
- map = decko.editorContentFunctionMap unless map?
25
- this_form = $(this)
26
- $.each map, (selector, fn) ->
27
- this_form.setContentFields(selector, fn)
28
- setContentFields: (selector, fn) ->
29
- $.each @find(selector), ->
30
- $(this).setContentField(fn)
31
- setContentField: (fn) ->
32
- field = @closest('.card-editor').find('.d0-card-content')
33
- init_val = field.val() # tinymce-jquery overrides val();
34
- # that's why we're not using it.
35
- new_val = fn.call this
36
- field.val new_val
37
- field.change() if init_val != new_val
38
-
39
- $(window).ready ->
40
- # decko.initializeEditors $('body > :not(.modal)')
41
- setTimeout (-> decko.initializeEditors $('body > :not(.modal)')), 10
42
- # dislike the timeout, but without this forms with multiple TinyMCE editors
43
- # were failing to load properly
44
- # I couldn't reproduce that problem described above -pk
45
-
46
- $('body').on 'submit', '.card-form', ->
47
- $(this).setContentFieldsFromMap()
48
- $(this).find('.d0-card-content').attr('no-autosave','true')
49
- true
50
-
51
- setInterval (-> $('.card-form').setContentFieldsFromMap()), 20000
52
-
53
-
54
-
55
-
@@ -1,176 +0,0 @@
1
- # filter object that manages dynamic sorting and filtering
2
-
3
- # el can be any element inside widget
4
- decko.filter = (el) ->
5
- closest_widget = $(el).closest "._filter-widget"
6
- @widget =
7
- if closest_widget.length
8
- closest_widget
9
- else
10
- $(el).closest("._filtered-content").find "._filter-widget"
11
-
12
- @activeContainer = @widget.find "._filter-container"
13
- @dropdown = @widget.find "._add-filter-dropdown"
14
- @dropdownItems = @widget.find "._filter-category-select"
15
- @form = @widget.find "._filter-form"
16
- @quickFilter = @widget.find "._quick-filter"
17
-
18
- @showWithStatus = (status) ->
19
- f = this
20
- $.each (@dropdownItems), ->
21
- item = $(this)
22
- if item.data status
23
- f.activate item.data("category")
24
-
25
- @reset = () ->
26
- # @clear()
27
- @dropdownItems.show()
28
- @restrict @form.find("._reset-filter").data("reset")
29
-
30
- @clear = () ->
31
- @activeContainer.find(".input-group").remove()
32
-
33
- @activate = (category, value) ->
34
- @activateField category, value
35
- @hideOption category
36
-
37
- @showOption = (category) ->
38
- @dropdown.show()
39
- @option(category).show()
40
-
41
- @hideOption = (category) ->
42
- @option(category).hide()
43
- @dropdown.hide() if @dropdownItems.length <= @activeFields().length
44
-
45
- @activeFields = () ->
46
- @activeContainer.find "._filter-input"
47
-
48
- @option = (category) ->
49
- @dropdownItems.filter("[data-category='#{category}']")
50
-
51
- @findPrototype = (category) ->
52
- @widget.find "._filter-input-field-prototypes ._filter-input-#{category}"
53
-
54
- @activateField = (category, value) ->
55
- field = @findPrototype(category).clone()
56
- @fieldValue field, value
57
- @dropdown.before field
58
- @initField field
59
- field.find("input, select").first().focus()
60
-
61
- @fieldValue = (field, value) ->
62
- if typeof(value) == "object"
63
- @compoundFieldValue field, value
64
- else
65
- @simpleFieldValue field, value
66
-
67
- @simpleFieldValue = (field, value) ->
68
- input = field.find("input, select")
69
- input.val value if (typeof value != 'undefined')
70
-
71
- @compoundFieldValue = (field, vals) ->
72
- for key of vals
73
- input = field.find "#filter_value_" + key
74
- input.val vals[key]
75
-
76
- @removeField = (category)->
77
- @activeField(category).remove()
78
- @showOption category
79
-
80
- @initField = (field) ->
81
- @initSelectField field
82
- decko.initAutoCardPlete field.find("input")
83
- # only has effect if there is a data-options-card value
84
-
85
- @initSelectField = (field) ->
86
- field.find("select").select2(
87
- containerCssClass: ":all:"
88
- width: "auto"
89
- dropdownAutoWidth: "true"
90
- )
91
-
92
- @activeField = (category) ->
93
- @activeContainer.find("._filter-input-#{category}")
94
-
95
- @isActive = (category) ->
96
- @activeField(category).length
97
-
98
- @restrict = (data) ->
99
- @clear()
100
- for key of data
101
- @activateField key, data[key]
102
- @update()
103
-
104
- @addRestrictions = (hash) ->
105
- for category of hash
106
- @removeField category
107
- @activate category, hash[category]
108
- @update()
109
-
110
- @removeRestrictions = (hash) ->
111
- for category of hash
112
- @removeField category
113
- @update()
114
-
115
- # triggers update
116
- @setInputVal = (field, value) ->
117
- select = field.find "select"
118
- if select.length
119
- @setSelect2Val select, value
120
- else
121
- @setTextInputVal field.find("input"), value
122
-
123
- # this triggers change, which updates form
124
- # if we just use simple "val", the display doesn't update correctly
125
- @setSelect2Val = (select, value) ->
126
- value = [value] if select.attr("multiple") && !Array.isArray(value)
127
- select.select2 "val", value
128
-
129
- @setTextInputVal = (input, value) ->
130
- input.val value
131
- @update()
132
-
133
- @updateLastVals = ()->
134
- @activeFields().find("input, select").each ()->
135
- $(this).data "lastVal", $(this).val()
136
-
137
- @updateUrlBar = () ->
138
- return if @widget.closest('._noFilterUrlUpdates')[0]
139
- window.history.pushState "filter", "filter", '?' + @form.serialize()
140
-
141
- @update = ()->
142
- @updateLastVals()
143
- @updateQuickLinks()
144
- @form.submit()
145
- @updateUrlBar()
146
-
147
- @updateQuickLinks = ()->
148
- widget = this
149
- links = @quickFilter.find "._filter-link"
150
- links.addClass "active"
151
- links.each ->
152
- link = $(this)
153
- opts = link.data "filter"
154
- for key of opts
155
- widget.deactivateQuickLink link, key, opts[key]
156
-
157
- @deactivateQuickLink = (link, key, value) ->
158
- sel = "._filter-input-#{key}"
159
- $.map [@form.find("#{sel} input, #{sel} select").val()], (arr) ->
160
- arr = [arr].flat()
161
- link.removeClass "active" if $.inArray(value, arr) > -1
162
-
163
- @updateIfChanged = ()->
164
- @update() if @changedSinceLastVal()
165
-
166
- @updateIfPresent = (category)->
167
- val = @activeField(category).find("input, select").val()
168
- @update() if val && val.length > 0
169
-
170
- @changedSinceLastVal = () ->
171
- changed = false
172
- @activeFields().find("input, select").each ()->
173
- changed = true if $(this).val() != $(this).data("lastVal")
174
- changed
175
-
176
- this