|
1 | | -// Disable chosing individual objects when a scrip is applied globally |
2 | | -htmx.onLoad(function(elt) { |
3 | | - var global_checkboxes = [ |
4 | | - "form[name=AddRemoveScrip] input[type=checkbox][name^=AddScrip-][value=0]", |
5 | | - "form input[type=checkbox][name^=AddCustomField-][value=0]" |
6 | | - ]; |
7 | | - jQuery(elt).find(global_checkboxes.join(", ")) |
8 | | - .change(function(){ |
9 | | - var self = jQuery(this); |
10 | | - var checked = self.prop("checked"); |
11 | | - |
12 | | - self.closest("form") |
13 | | - .find("table.collection input[type=checkbox]") |
14 | | - .prop("disabled", checked); |
15 | | - }); |
16 | | -}); |
17 | | - |
18 | 1 | // Replace user references in history with the HTML versions |
19 | 2 | function ReplaceUserReferences(elt) { |
20 | 3 | var users = jQuery(elt).find(".user[data-replace=user]"); |
@@ -118,71 +101,3 @@ htmx.onLoad(function(elt) { |
118 | 101 | } |
119 | 102 | }); |
120 | 103 | }); |
121 | | - |
122 | | -htmx.onLoad( function(elt) { |
123 | | - jQuery(elt).find("input[type=file]").change( function() { |
124 | | - var input = jQuery(this); |
125 | | - var warning = input.next(".invalid"); |
126 | | - |
127 | | - if ( !input.val().match(/"/) ) { |
128 | | - warning.hide(); |
129 | | - } else { |
130 | | - if (warning.length) { |
131 | | - warning.show(); |
132 | | - } else { |
133 | | - input.val(""); |
134 | | - jQuery("<span class='invalid'>") |
135 | | - .text(loc_key("quote_in_filename")) |
136 | | - .insertAfter(input); |
137 | | - } |
138 | | - } |
139 | | - }); |
140 | | -}); |
141 | | - |
142 | | -htmx.onLoad(function(elt) { |
143 | | - jQuery(elt).find("#UpdateType").change(function(ev) { |
144 | | - jQuery(".messagebox-container") |
145 | | - .removeClass("action-response action-private") |
146 | | - .addClass("action-"+ev.target.value); |
147 | | - }); |
148 | | -}); |
149 | | - |
150 | | -htmx.onLoad(function(elt) { |
151 | | - jQuery(elt).find('.toggle-txn-details:not(.toggle-txn-details-registered)').click(function () { |
152 | | - return toggleTransactionDetails.apply(this); |
153 | | - }).addClass('toggle-txn-details-registered'); |
154 | | -}); |
155 | | - |
156 | | -const article_link_focus_handler = function() { |
157 | | - // if input focus in last row add another row of inputs |
158 | | - const link_div = jQuery(this).parent().parent(); |
159 | | - const links_div = link_div.parent(); |
160 | | - if ( link_div.attr('data-link-number') == links_div.attr('data-link-count') ) { |
161 | | - const link_count = parseInt( links_div.attr('data-link-count') ) + 1; |
162 | | - links_div.attr( 'data-link-count', link_count ); |
163 | | - let new_link_div = link_div.clone(); |
164 | | - new_link_div.attr( 'data-link-number', link_count ); |
165 | | - new_link_div.find('[name^="article-link-"]').each(function(){ |
166 | | - var oldName = jQuery(this).attr('name'); |
167 | | - var newName = oldName.replace( /-\d+$/, '-' + link_count ); |
168 | | - jQuery(this).attr( 'name', newName ); |
169 | | - }); |
170 | | - new_link_div.find('[name^="article-link-"]').on( "focus", article_link_focus_handler ); |
171 | | - links_div.append(new_link_div); |
172 | | - } |
173 | | -}; |
174 | | -htmx.onLoad(function(elt) { |
175 | | - jQuery('[name^="article-link-"]').on( "focus", article_link_focus_handler ); |
176 | | -}); |
177 | | -htmx.onLoad(function(elt) { |
178 | | - jQuery(elt).find('.article-basics [name="Type"]').change(function(ev) { |
179 | | - if ( jQuery(this).val() == 'Content' ) { |
180 | | - jQuery('#article-type-links').addClass('hidden'); |
181 | | - jQuery('#article-type-content').removeClass('hidden'); |
182 | | - } |
183 | | - else { |
184 | | - jQuery('#article-type-content').addClass('hidden'); |
185 | | - jQuery('#article-type-links').removeClass('hidden'); |
186 | | - } |
187 | | - }); |
188 | | -}); |
0 commit comments