1 | javascript:(async function() {if($('#em-fragment').length == 0) {window.open('/EmoticonManager2', 'new');return;}if($('#emos_delete').length == 0) {$('#pop-window-tabs').html($('#pop-window-tabs').html() + "已開啟選擇表符功能");$('body').append('<div id="emos_delete" style="display:none;"></div>').append('<style>div#pop-window-tabs {text-align:right; padding:10px 10px 0 0; color:#FFF; font-size:20px; background:#ea4949;}#em-emos-meta-container ul li[data-del]{border-bottom:4px #66C solid;}</style>');$('body').on('click', 'li.emo-img', (e)=>{let target = $(e.target);if(!target.hasClass('emo-img')) target = target.parent();if(typeof(target.attr('data-del')) != "undefined") target.attr('data-del', null);else target.attr('data-del', "");});}else {if($('#em-fragment:not(.hidden)').length == 0) {alert("開啟表符窗才能使用"); return;}let err_count = 0;let ids = [];let cur_emos = $('#em-fragment li[data-del]');for(let ff=0; ff<cur_emos.length; ff++)ids.push(cur_emos.eq(ff).attr('data-h'));if(ids.length == 0) {alert("未選擇表符"); return;}for(let hash_id of ids) {await $.ajax("/Emoticons/remove", {data: {token: GLOBAL.session_user.token, hash_id: hash_id},type: "post"}).done(() => {$('#em-fragment li[data-h="' + hash_id + '"]').remove();}).fail(function() { err_count++; });}if(err_count) alert("有" + err_count + "個表符發生錯誤");confirm("成功刪除" + ids.length + "個表符");}})() |
Direct link: https://paste.plurk.com/show/2SwTN3nUfvCnmFJZNOoo