User:קיפודנחש/searchPersistence.js

// teach s&r form in advance toolbar to remember its content$(function() {var controls = '#wikieditor-toolbar-replace-search, #wikieditor-toolbar-replace-replace, #wikieditor-toolbar-replace-case, #wikieditor-toolbar-replace-regex';$('body').on('change', controls, function() {$this = $(this);$.cookie($this.attr('id'),  $(this).attr('type') == 'checkbox' ? ($this.prop('checked') ? 'checked' : '') : $(this).val(),  {path: '/', expires: 30})});$('body').on('dialogopen', '#wikieditor-toolbar-replace-dialog', function() {$.each(controls.split(/,\s*/), function(ind, name) {control = $(name); val = $.cookie(name.replace('#',''));if (control.attr('type') == 'checkbox')control.prop('checked', val);elsecontrol.val(val);});});});