/** * Attaches the mechanics on our plugin's button * * @param {jQuery} $btn the button itself * @param {object} props unused * @param {string} edid the editor's ID * @return {string} */ function addBtnActionPlugin_watchcycle($btn, props, edid) { 'use strict'; const pickerid = 'picker' + window.pickercounter; const $picker = jQuery(createPicker(pickerid, [], edid)) .attr('aria-hidden', 'true') .addClass('plugin-watchcycle') ; window.pickercounter += 1; const l10n = LANG.plugins.watchcycle; /** * AJAX request for users and groups * Adapted from Struct plugin * * @param {function} fn Callback on success * @param {string} id Call identifier * @param {string} param Pass the parameter to backend */ const ajax_watchcycle = function(fn, id, param) { let data = {}; data['call'] = 'plugin_watchcycle_' + id; data['param'] = param; jQuery.post(DOKU_BASE + 'lib/exe/ajax.php', data, fn, 'json') .fail(function (result) { if (result.responseJSON) { if (result.responseJSON.stacktrace) { console.error(result.responseJSON.error + "\n" + result.responseJSON.stacktrace); } alert(result.responseJSON.error); } }); }; /** * Autocomplete split helper * @param {string} val * @returns {string} */ const autcmpl_split = function(val) { return val.split(/,\s*/); }; /** * Autocomplete helper returns last part of comma separated string * @param {string} term * @returns {string} */ const autcmpl_extractLast = function(term) { return autcmpl_split(term).pop(); }; const $watchCycleForm = jQuery('