card-mod-script 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 167f8b8fcb8a302867abf996072f6ee39bf8bb70d36982b02816278629e8e87a
4
- data.tar.gz: 65634fe3e1738ac79d697bb63e670604643ae9f3a12ea3e151a3491eff9fd307
3
+ metadata.gz: 75d3a886dfedda68dc63b519d04fa19582cc76fe3c3a2ac795a5301d0b8221e4
4
+ data.tar.gz: b5e713c2eee8726858dcd0e947cfea6558179a555168d7f67e78c20e48818e24
5
5
  SHA512:
6
- metadata.gz: bdf544b35beab9a381b173e095bf08503c5874e78081d261790409d04ac4d76b750a1024bfea0358dbc71588af41c05b978dfdca008afeb55fede48c093a48bf
7
- data.tar.gz: 399d001490d2c3bccfa048bf5f032b6229d4def51fc60c7bac66e4f39b40653b42667f331cad4bba1fe7120047ab8d367be20344ab5de093203aa8ab63ab30b5
6
+ metadata.gz: 282071ff1352a01520318ff5164fbe7228ed1fd49c4a71ce37e96281e4e425fa9a51d5fbfc4d2cf5edfa02cebd8fca5f4b945e563ced5ae1fbfb484f83e18696
7
+ data.tar.gz: 63cfeb45c2fec9d52389b97d1e5100bb11cf75f39d8faa91c5d7f3eea700d70b46ee405f5568c4159fe11aafa13864a4f5a3435221320053933eafa41d811f45
@@ -60,6 +60,9 @@ jQuery.fn.extend {
60
60
  .data("modal-origin-slot-id")
61
61
  @find(".modal-body .card-slot").attr("data-modal-origin-slot-id", origin_slot_id)
62
62
 
63
+ modalOriginSlot: ()->
64
+
65
+
63
66
  modalSlot: ->
64
67
  slot = $("#modal-container")
65
68
  if slot.length > 0 then slot else decko.createModalSlot()
@@ -1,16 +1,15 @@
1
1
  checkNameAfterTyping = null
2
2
 
3
3
  $(window).ready ->
4
- $('body').on 'click', '.renamer-updater', ->
4
+ $('body').on 'click', '._renamer-updater', ->
5
5
  $(this).closest('form').find('#card_update_referers').val 'true'
6
6
 
7
- $('body').on 'submit', '.edit_name-view .card-form, .name_form-view .card-form', ->
8
- confirmer = $(this).find '.alert'
9
- if confirmer.is ':hidden'
10
- if $(this).find('#referers').val() > 0
11
- $(this).find('.renamer-updater').show()
12
-
13
- confirmer.show 'blind'
7
+ $('body').on 'submit', '._rename-form', ->
8
+ f = $(this)
9
+ confirm = f.find '.alert'
10
+ if confirm.is ':hidden'
11
+ referenceConfirm f
12
+ confirm.show 'blind'
14
13
  false
15
14
 
16
15
  $('body').on 'keyup', '.name-editor input', (event) ->
@@ -25,6 +24,16 @@ $(window).ready ->
25
24
  checkNameAfterTyping = null
26
25
  , 400
27
26
 
27
+
28
+ referenceConfirm = (form)->
29
+ confirm = form.find '._rename-reference-confirm'
30
+ return unless confirm.data('referer-count') > 0
31
+ confirm.show()
32
+ btn = form.find '._renamer-updater'
33
+ btn.show()
34
+ btn.focus()
35
+
36
+
28
37
  checkName = (box) ->
29
38
  name = box.val()
30
39
  decko.pingName name, (data)->
@@ -48,4 +57,3 @@ checkName = (box) ->
48
57
  msg.html "\"<a href='#{href}'>#{name}</a>\" #{qualifier} use"
49
58
  else
50
59
  msg.html ''
51
-
@@ -78,7 +78,13 @@ jQuery.fn.extend
78
78
  isSlot: ->
79
79
  $(this).hasClass "card-slot"
80
80
 
81
- isMain: -> @slot().parent('#main')[0]
81
+ isMain: ->
82
+ @slot().parent('#main')[0]
83
+
84
+ isMainOrMainModal: ->
85
+ el = $(this)
86
+ el = el.findOriginSlot("modal") if el.closest(".modal")[0]
87
+ el.isMain()
82
88
 
83
89
  findSlot: (selector) ->
84
90
  if selector == "modal-origin"
@@ -94,19 +94,26 @@ $(window).ready ->
94
94
  $(this).closest('.slotter').data("slotter-mode", "update-origin")
95
95
 
96
96
  $('body').on 'submit', 'form.slotter', (event)->
97
- if (target = $(this).attr 'main-success') and $(this).isMain()
98
- input = $(this).find '[name=success]'
99
- if input and input.val() and !(input.val().match /^REDIRECT/)
100
- input.val(
101
- (if target == 'REDIRECT' then target + ': ' + input.val() else target)
102
- )
103
- if $(this).data('recaptcha') == 'on'
104
- return $(this).handleRecaptchaBeforeSubmit(event)
97
+ form = $(this)
98
+ if form.data("main-success") and form.isMainOrMainModal()
99
+ form.mainSuccess()
100
+ if form.data('recaptcha') == 'on'
101
+ return form.handleRecaptchaBeforeSubmit(event)
105
102
 
106
103
  $('body').on 'ajax:beforeSend', '.slotter', (event, xhr, opt)->
107
- $(this).slotterBeforeSend(opt)
104
+ $(this).slotterBeforeSend opt
108
105
 
109
106
  jQuery.fn.extend
107
+ mainSuccess: ()->
108
+ form = $(this)
109
+ $.each form.data("main-success"), (key, value)->
110
+ inputSelector = "[name=success\\[" + key + "\\]]"
111
+ input = form.find inputSelector
112
+ unless input[0]
113
+ input = $('<input type="hidden" name="success[' + key + ']"/>')
114
+ form.append input
115
+ input.val value
116
+
110
117
  slotterSuccess: (event, data) ->
111
118
  unless @hasClass("slotter")
112
119
  console.log "warning: slotterSuccess called on non-slotter element #{this}"
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
+ require "coderay"
3
4
  require "uglifier"
4
5
 
5
6
  def self.included host_class
@@ -22,7 +23,7 @@ end
22
23
 
23
24
  def compress_js input
24
25
  Uglifier.compile input
25
- rescue => e
26
+ rescue StandardError => e
26
27
  # CoffeeScript is compiled in a view
27
28
  # If there is a CoffeeScript syntax error we get the rescued view here
28
29
  # and the error that the rescued view is no valid Javascript
@@ -17,7 +17,7 @@ format do
17
17
 
18
18
  def compile_coffee script
19
19
  ::CoffeeScript.compile script
20
- rescue => e
20
+ rescue StandardError => e
21
21
  line_nr = e.to_s.match(/\[stdin\]:(\d*)/)&.capture(0)&.to_i
22
22
  line = script.lines[line_nr - 1] if line_nr
23
23
  raise Card::Error, "CoffeeScript::Error (#{card.name}): #{e.message}: #{line}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-03-15 00:00:00.000000000 Z
13
+ date: 2021-07-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.101.2
21
+ version: 1.102.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.101.2
28
+ version: 1.102.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-machines
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.11.2
35
+ version: 0.12.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.11.2
42
+ version: 0.12.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: card-mod-list
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.11.2
49
+ version: 0.12.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.11.2
56
+ version: 0.12.0
57
57
  description: ''
58
58
  email:
59
59
  - info@decko.org
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.0.3
213
+ rubygems_version: 3.2.15
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: JavaScript, CoffeeScript, etc.