「Every Page Worker 💢💢」を修復更新しました
管理画面サイドメニュー変更に対応して、主に「記事の編集・削除」のリストデザインを修復しました。
パネルの配色が変わりましたが、操作や仕様上の変更はありません。
実際の利用方法
このバージョンは「記事の本文」「記事タイトル」の検索の自動処理に特化したものです。 検索文字を「テスト」で仮設定しているので、実際に利用する場合は、この文字列を必要な検索文字に置換えてください。
書換える行は、コメント部に ⬛🟧⬛ のマークがある以下の2箇所です。
● 433行 : 検索1:「記事の本文」の検索:結果は Chexk1
● 449行:検索2:「記事タイトル」の検索:結果は Check2
検索文字列の記入は「 /検索文字列/ 」の様に「/」で挟まれた形の必要があります。
基本的な扱いは以下のページを参照ください。
「Every Page Worker 💢💢」を利用するには
このツールは Chrome / Edge / Firefox版の拡張機能「Tampermonkey」上で動作します。 以下に、このツールの導入手順を簡単に説明します。
❶「Tampermonkey」を導入します
◎ 使用しているブラウザに拡張機能「Tampermonkey」を導入する事が必要です。
既に「Tampermonkey」を導入している場合は、この手順 ❶ は不要です。
拡張機能の導入については、以下のページに簡単な説明があるので参照ください。
❷「Tampermonkey」にスクリプトを登録します
◎「Tampermonkey」の「+」マークの「新規スクリプト」タブを開きます。
◎「新規スクリプト」には、最初からテンプレートが記入されています。 これは全て削除して、完全に空白の編集枠に 下のコードをコピー&ペーストします。
〔コピー方法〕 軽量シンプルなツール「PreBox Button 」を使うと
コード枠内を「Ctrl+左Click」➔「Copy code 」を「左Click」
の操作で、掲載コードのコピーが可能になります。
◎ 最後に「ファイル」メニューの「保存」を押すと、ツールが使用可能になります。
〔 Every Page Worker 💢💢 〕 ver. 4.6
// ==UserScript==
// @name Every Page Worker 💢💢
// @namespace http://tampermonkey.net/
// @version 4.6
// @description 「記事の編集・削除」でブログ全記事を開いて検索を実行
// @author Ameba Blog User
// @match https://blog.ameba.jp/ucs/entry/srventrylist*
// @match https://blog.ameba.jp/ucs/entry/srventryupdate*
// @run-at document-start
// @grant none
// ==/UserScript==
window.addEventListener('DOMContentLoaded', function(){ // CSSデザインを適用するためのスクリプト
let body_id=document.body.getAttribute('id');
if(body_id=='entryListEdit'){ //「記事の編集・削除」の画面にのみCSSを適用
let style=
'<style>'+
'.include-ex-linkBtn, .save-browserPush, .save-gsc, .save-hashtag-module, '+
'.adcrossBanner { display: none; } '+
'#globalHeader, #ucsHeader, #ucsMainLeft h1, .l-ucs-sidemenu-area, #ucsMainRight, '+
'#entryList dl, #entryList .rightCol input, .actionControl, '+
'#footerAd, #globalFooter, .checkboxAllControl { display: none !important; } '+
'#entryList .selection-bar { display: none; } '+
'#ucsContent { width: 840px !important; background: #fff; '+
'box-shadow: 0 0 0 100vh #c5d8e1; border-radius: 0; } '+
'#ucsContent::before { content: unset; } '+
'#ucsMain { margin-top: 15px; padding: 0 !important; background: #fff; border-radius: 0; } '+
'#ucsMainLeft { width: 838px !important; padding: 0 15px; float: none; } '+
'#entryList li{ height: 24px; padding: 8px 5px 5px !important; } '+
'#entryList li:hover { background-color: #e2eef0; } '+
'#entryList li .entry-column { padding-left: 16px !important; } '+
'#entryList .leftCol, #entryList .titleCol h2 { width: 440px !important; line-height: 24px; } '+
'.leftCol a { text-decoration: none !important; } .leftCol a:visited { color: #3970b5; } '+
'#entryList .rightCol { display: flex; width: 320px !important; '+
'flex-direction: row; margin-top: -2px; margin-left: 0; } '+
'#entryList .txtCol { white-space: nowrap; font-size: 13px; '+
'margin-top: 4px; margin-bottom: 2px; line-height: 16px; } '+
'#entryList .status-text { width: 64px; margin-bottom: -4px; padding: 2px 4px 0; '+
'font-weight: normal; color: #000; } '+
'#entryList .txtCol .date { display: inline-block; padding: 2px 4px 0; font-size: 13px; '+
'color: #000; } '+
'#entryList .deleteCol { margin: 0 10px; } '+
'.deleteCol a:nth-child(2), .deleteCol a:nth-child(3), .rightCol input { '+
'display: none !important; } '+
'#entryList .deleteCol a { padding: 2px 5px 0; font-size: 14px; '+
'text-decoration: none !important; border: 1px solid #aaa; border-radius: 4px; '+
'background: linear-gradient(0deg, #eee, #fff); } '+
'#entryList .deleteCol a:hover { outline: auto #1976d2; } '+
'#entryList .deleteCol .process svg { width: 16px; height: 16px; } '+
'#entryList ul input[value="1"] + input + li .txtCol span:first-child { display: inline-block; '+
'text-indent: 12px; color: #fff; background: #2196f3 !important; } '+
'#entryList ul input[value="2"] + input + li .txtCol span:first-child { display: inline-block; '+
'text-indent: 2px; overflow: hidden; color: #fff; background: #009688 !important; } '+
'#entrySort { margin-bottom: 2px; } '+
'#entryMonth { font-size: 14px; overflow: visible; margin-top: 3px; } '+
'#entryMonth li, #entryMonth #nowMonthLi { padding: 2px 10px 0; } '+
'#nowMonth { padding: 1px 6px 0; border: none; border-radius: 1px; '+
'box-shadow: 0 0 0 2px #0066cc; color: #000; } '+
'#entryListEdit form { display: flex; flex-direction: column; } #entrySort { order: -2; } '+
'.pagingArea { order: -1; margin-bottom: -33px; position:unset !important; } '+
'.pagingArea a { border: 1px solid #888; } .pagingArea .active{ border: 2px solid #0066cc; } '+
'.pagingArea a, .pagingArea .active, .pagingArea .disabled { font-size: 14px; line-height: 23px; } '+
'#sorting { margin: 36px 0 4px; padding: 2px 0; height: 78px; background: #ddedf3; } '+
'#sorting select, #sorting ul { display: none; } '+
'#div0 { color: #333; font-size: 14px; margin: 0 -10px 0 15px; } '+
'#div1 { color: #000; font-size: 14px; margin: 1px 15px; background: #c0dbed; } '+
'#list_snap { padding: 2px 0 0; margin: 7px 20px 7px 0; width: 180px; } '+
'#reset { padding: 2px 0 0; margin-right: 20px; width: 60px; } '+
'#export { padding: 2px 0 0; margin: 7px 10px 7px 0; width: 100px; } '+
'.snap_result { display: inline-block; margin: 6px 4px 4px 12px; } '+
'.num { padding: 2px 2px 0 6px; width: 40px; } '+
'.editor_open { padding: 2px 0 0; margin: 0 20px 0 4px; width: 50px; } '+
'input { font-family: meiryo; font-size: 14px; } '+
'.ch1, .ch2 { font: 15px/25px Meiryo; color: #0277bd; opacity: 0; }'+
'</style>';
document.head.insertAdjacentHTML('beforeend', style);
let rightCol=document.querySelectorAll('#entryList .rightCol');
for(let k=0; k<rightCol.length; k++){
let iAH='<span class="ch1">❶</span><span class="ch2">❷</span>';
rightCol[k].insertAdjacentHTML('beforeend', iAH); }
}})
window.addEventListener('load', function(){ // このスクリプトは親ウインドウで働くメインスクリプト
let body_id=document.body.getAttribute('id');
if(body_id=='entryListEdit'){ // 親ウインドウの条件
let drive_mode; // ページ更新時の動作モード
let blogDB={}; //「対象記事のID/チェックフラグ または内容」の記録配列
let entry_id_DB; // ID検索用の配列
let pub_1; // flag 1 が記録された記事総数
let pub_2; // flag 2 が記録された記事総数
let entry_id;
let entry_target;
let list_bar;
let editor_flg;
let next_target; // ページ内の次の対象記事
let new_win;
let link_target;
let editor_iframe;
let iframe_doc;
let ua=0;
let agent=window.navigator.userAgent.toLowerCase();
if(agent.indexOf('firefox') > -1){ ua=1; } // Firefoxの場合のフラグ
if(agent.indexOf('edge') > -1){ ua=2; } // Edgeの場合のフラグ
let read_json=localStorage.getItem('EPW_DB_back'); // ローカルストレージ 保存名
blogDB=JSON.parse(read_json);
if(blogDB==null){
blogDB=[['epw00000000', 's', 0]]; }
drive_mode=blogDB[0][1]; // 起動時に動作フラグを取得
blogDB[0][1]='s'; // リロード時等のためにリセット
let write_json=JSON.stringify(blogDB);
localStorage.setItem('EPW_DB_back', write_json); // ローカルストレージ 保存
reg_set();
function reg_set(){
let k;
entry_id_DB=[]; // リセット
pub_1=0;
pub_2=0;
for(k=0; k<blogDB.length; k++){
entry_id_DB[k]=blogDB[k][0]; // ID検索用の配列を作成
if(blogDB[k][1]=='1'){
pub_1 +=1; } // flag 1 が記録された記事総数(検索1)
if(blogDB[k][2]=='1'){
pub_2 +=1; }}} // flag 2 が記録された記事総数(検索2)
entry_id=document.querySelectorAll('input[name="entry_id"]');
entry_target=document.querySelectorAll('.deleteCol');
list_bar=document.querySelectorAll('#entryList li');
control_pannel(drive_mode);
hit_display();
function control_pannel(dm){
let sty;
let insert_div0;
insert_div0=document.createElement('div');
insert_div0.setAttribute('id', 'div0');
let box=document.querySelector('#sorting');
box.appendChild(insert_div0);
let insert_div1;
insert_div1=document.createElement('div');
insert_div1.setAttribute('id', 'div1');
box.appendChild(insert_div1);
let button1=document.createElement('input');
button1.setAttribute('id', 'list_snap');
button1.setAttribute('type', 'submit');
insert_div0.appendChild(button1);
if(dm=='s'){
button1.setAttribute('value', '全記事へ処理を開始 ▶'); }
else if(dm=='c'){
button1.setAttribute('value', ' 処理を一旦停止 ❚❚'); }
else if(dm=='e'){
button1.setAttribute('value', '処理が全て終了しました'); }
button1.addEventListener('click', function(e){
e.preventDefault();
start_stop(); }, false);
function start_stop(){
if(drive_mode=='s'){ // 最初の起動直後
let conf_str=' 🔴 このページ以降の記事に連続した処理を実行します'+
'\n\n 停止ボタンのクリックで処理停止/処理再開ができます';
let ok=confirm(conf_str);
if(ok){
drive_mode='c'; // ページ内の連続処理
button1.setAttribute('value', ' 処理を一旦停止 ❚❚');
next(); }}
else if(drive_mode=='c'){ // 連続動作状態の場合
drive_mode='p'; // クリックされたら「p」停止モード
button1.setAttribute('value', ' 処理を再開する ▶'); }
else if(drive_mode=='p'){ // 動作停止状態の場合
drive_mode='c'; // クリックされたら連続動作を再開
button1.setAttribute('value', ' 処理を一旦停止 ❚❚');
open_win(next_target); }}
if(dm=='c'){ // ページを開いた時に「c」は連続動作
setTimeout(next, 200); } // 「c」連続動作はぺージ遷移時 0.2sec で自動実行 ⭕
else if(dm=='e'){ // 「e」は終了
button1.style.pointerEvents='none'; }
let button2=document.createElement('input');
button2.setAttribute('id', 'reset');
button2.setAttribute('type', 'submit');
button2.setAttribute('value', '初期化');
insert_div0.appendChild(button2);
button2.onclick=function(e){
e.preventDefault();
blogDB=[['epw00000000', 's', 0]];
let write_json=JSON.stringify(blogDB);
localStorage.setItem('EPW_DB_back', write_json); // ローカルストレージ保存
snap_disp();
hit_display_clear();
document.querySelector('#reset').value='〔 〕'; }
let button3=document.createElement('input');
button3.setAttribute('id', 'export');
button3.setAttribute('type', 'submit');
button3.setAttribute('value', 'ファイル保存');
insert_div0.appendChild(button3);
button3.onclick=function(e){
e.preventDefault();
let write_json=JSON.stringify(blogDB);
let blob=new Blob([write_json], {type: 'application/json'});
if(ua==2){
window.navigator.msSaveBlob(blob, 'EPW.json'); } // 保存ファイル名
else{
let a_elem=document.createElement('a');
a_elem.href=URL.createObjectURL(blob);
a_elem.download='EPW.json'; // 保存ファイル名
if(ua==1){
a_elem.target='_blank';
document.body.appendChild(a_elem); }
a_elem.click();
if(ua==1){
document.body.removeChild(a_elem); }
URL.revokeObjectURL(a_elem.href); }}
let button4=document.createElement('input');
button4.setAttribute('type', 'file');
button4.setAttribute('style', 'vertical-align: 1px; width: 390px');
if(ua==2){
button4.setAttribute('style', 'vertical-align: 0; width: 270px; direction: rtl'); }
insert_div0.appendChild(button4);
button4.addEventListener("change", function(){
if(!(button4.value)) return; // ファイルが選択されない場合
let file_list=button4.files;
if(!file_list) return; // ファイルリストが選択されない場合
let file=file_list[0];
if(!file) return; // ファイルが無い場合
let file_reader=new FileReader();
file_reader.readAsText(file);
file_reader.onload=function(){
if(file_reader.result.slice(0, 15)=='[["epw00000000"'){ // EPW.jsonの確認
let data_in=JSON.parse(file_reader.result);
blogDB=data_in; // 読込み上書き処理
let write_json=JSON.stringify(blogDB);
localStorage.setItem('EPW_DB_back', write_json); // ローカルストレージ 保存
button2.setAttribute('value', '初期化'); // 初期化後なら読み込んだ事を示す
snap_disp(); }
else{
alert(" ⛔ 不適合なファイルです EPW.json ファイルを選択してください");}};});
let span5=document.createElement('span');
span5.setAttribute('id', 'snap_result1');
span5.setAttribute('class', 'snap_result');
insert_div1.appendChild(span5);
let button6=document.createElement('input');
button6.setAttribute('id', 'num_1');
button6.setAttribute('class', 'num');
button6.setAttribute('type', 'number');
button6.setAttribute('min', '0');
insert_div1.appendChild(button6);
let button7=document.createElement('input');
button7.setAttribute('class', 'editor_open');
button7.setAttribute('type', 'submit');
button7.setAttribute('value', '編集');
insert_div1.appendChild(button7);
button7.onclick=function(e){
e.preventDefault();
let k;
let pub_1_DB=[]; // pub_1 の entry_id の配列
if(pub_1>0){
for(k=0; k<blogDB.length; k++){
if(blogDB[k][1]=='1'){
pub_1_DB.push(blogDB[k][0]); }}
if(button6.value>0){
let open_id=pub_1_DB[button6.value -1];
let pass=
'https://blog.ameba.jp/ucs/entry/srventryupdateinput.do?id='+ open_id;
let win_option='top=20, left=40, width=1020, height=900';
window.open(pass, button6.value, win_option); }}}
let span8=document.createElement('span');
span8.setAttribute('id', 'snap_result2');
span8.setAttribute('class', 'snap_result');
insert_div1.appendChild(span8);
let button9=document.createElement('input');
button9.setAttribute('id', 'num_2');
button9.setAttribute('class', 'num');
button9.setAttribute('type', 'number');
button9.setAttribute('min', '0');
insert_div1.appendChild(button9);
let button10=document.createElement('input');
button10.setAttribute('class', 'editor_open');
button10.setAttribute('type', 'submit');
button10.setAttribute('value', '編集');
insert_div1.appendChild(button10);
button10.onclick=function(e){
e.preventDefault();
let k;
let pub_2_DB=[]; // pub_2 の entry_id の配列
if(pub_2>0){
for(k=0; k<blogDB.length; k++){
if(blogDB[k][2]=='1'){
pub_2_DB.push(blogDB[k][0]); }}
if(button9.value>0){
let open_id=pub_2_DB[button9.value -1];
let pass=
'https://blog.ameba.jp/ucs/entry/srventryupdateinput.do?id='+ open_id;
let win_option='top=20, left=40, width=1020, height=900';
window.open(pass, button9.value, win_option); }}}
snap_disp();
} // control_pannel()
function snap_disp(){
reg_set();
let span5=document.querySelector('#snap_result1');
span5.textContent='記録件数:' + (blogDB.length -1) + ' Check ❶:';
let button6=document.querySelector('#num_1');
button6.value=pub_1;
button6.max=pub_1;
let span8=document.querySelector('#snap_result2');
span8.textContent='Check ❷:';
let button9=document.querySelector('#num_2');
button9.value=pub_2;
button9.max=pub_2; }
function hit_display(){
let ch1=document.querySelectorAll('.ch1');
let ch2=document.querySelectorAll('.ch2');
for(let k=0; k<ch1.length; k++){
let index=entry_id_DB.indexOf(entry_id[k].value);
if(index!=-1){ // IDがblogDBに記録されていた場合
if(blogDB[index][1]==1){
ch1[k].style.opacity='1'; }
else{
ch1[k].style.opacity='0'; }
if(blogDB[index][2]==1){
ch2[k].style.opacity='1'; }
else{
ch2[k].style.opacity='0'; }}}}
function hit_display_clear(){
let ch1=document.querySelectorAll('.ch1');
let ch2=document.querySelectorAll('.ch2');
for(let k=0; k<ch1.length; k++){
ch1[k].style.opacity='0';
ch2[k].style.opacity='0'; }}
function next(){
entry_id=document.querySelectorAll('input[name="entry_id"]');
if(entry_id.length >0){
open_win(0); } // 投稿記事がある場合 open_win を開始
else{
next_call();}} // 投稿記事が無ければ 次ページをcall する
function open_win(k){
next_target=k; // 送信完了までは未処理とする
new_win=Array(entry_target.length);
link_target=Array(entry_target.length);
link_target[k]=entry_target[k].getElementsByTagName('a')[0].getAttribute('href');
if(drive_mode=='c'){
let win_option='top=20, left=40, width=800, height=300';
new_win[k]=window.open(link_target[k], k, win_option);
list_bar[k].style.boxShadow='inset 0 0 0 2px #03a9f4'; // リスト欄に青枠表示
new_win[k].addEventListener('load', work, false); } // 子ウインドウの処理 🟦
function work(){
let editor_flg=new_win[k].document.querySelector('input[name="editor_flg"]');
if(editor_flg.value=="5"){ // 最新版エディタの文書の場合のみ処理
let interval=setInterval(find_iframe, 10); // iframe 読込み待機コード 🟥
function find_iframe(){
let editor_iframe=new_win[k].document.querySelector('.cke_wysiwyg_frame');
if(editor_iframe){
let iframe_doc=editor_iframe.contentWindow.document;
if(iframe_doc){
clearInterval(interval);
task();
function task(){ // taskは自動で開いたページでの作業コード / 作業目的で自製 🟥
Promise.all([
task_in1(),
task_in2(), // Check 2 不要な場合はコメントアウトか削除 🟥
strage_write(),
snap_disp(),
hit_display() ])
.then(end_target()) }
function task_in1(){ // ブログ本文の検索
let iframe_body=iframe_doc.querySelector('.cke_editable');
let result1=iframe_body.textContent.match(/テスト/); // 検索1:結果「flag 1」⬛🟧⬛
let index=entry_id_DB.indexOf(entry_id[k].value);
if(index==-1){ // IDがblogDBに記録されていない場合
if(result1){
blogDB.push([entry_id[k].value, 1, 0]); }} // 記事ID/フラグを追加
else{ // IDがblogDBに記録されていた場合
if(result1){
blogDB[index][1]=1; } // 記事ID/フラグ「1」を更新
else{
blogDB[index][1]=0; }} // 記事ID/フラグ「0」を更新
reg_set(); }
function task_in2(){ // 記事タイトルの検索
let title=new_win[k].document.querySelector('.p-title__text').value;
let result2=title.match(/テスト/); // 検索2:結果「flag 2」⬛🟧⬛
let index=entry_id_DB.indexOf(entry_id[k].value);
if(index==-1){ // IDがblogDBに記録されていない場合
if(result2){
blogDB.push([entry_id[k].value, 0, 1]); }} // 記事ID/フラグを追加
else{ // IDがblogDBに記録されていた場合
if(result2){
blogDB[index][2]=1; } // 記事ID/フラグ「1」を更新
else{
blogDB[index][2]=0; }} // 記事ID/フラグ「0」を更新
reg_set(); }
function strage_write(){
let write_json=JSON.stringify(blogDB);
localStorage.setItem('EPW_DB_back', write_json); }// ストレージ保存
}}}}
else{
end_target(); }
} // work()
function end_target(){ // 終了処理
let editor_flg=new_win[k].document.querySelector('input[name="editor_flg"]');
list_bar[k].style.boxShadow='none';
if(editor_flg.value=='5'){
list_bar[k].style.background='#caedf2'; }
else{
list_bar[k].style.background='#eceff1'; }
new_win[k].close();
setTimeout(()=>{
next_do(k); }, 10); //⏩
function next_do(k){
next_target=k+1;
if(next_target<entry_target.length){ open_win(next_target); }
else{ next_call(); }}} // ページの終りまで終了した状態
} // open_win()
function next_call(){
let win_url;
let current;
let pageid;
let next_url;
let pager;
let end;
blogDB[0][1]='c'; // 連続動作フラグを連続にセット
let write_json=JSON.stringify(blogDB);
localStorage.setItem('EPW_DB_back', write_json); // ローカルストレージ保存
win_url=window.location.search.substring(1,window.location.search.length);
current=win_url.slice(-6);
if(win_url.indexOf('pageID') ==-1){ // pageIDが無い 月のトップページの場合
pager=document.querySelector('.pagingArea');
if(pager){ // ページャーが有りその末尾でなければ同月次ページへ
next_url=
'https://blog.ameba.jp/ucs/entry/srventrylist.do?pageID=2&entry_ym=' + current;
window.open( next_url, '_self'); }
else{ // ページャーが無ければ次月トップページへ
current=make_next(current);
if(current!=0){ // 現在を越えないなら次月へ
next_url=
'https://blog.ameba.jp/ucs/entry/srventrylist.do?entry_ym=' + current;
window.open( next_url, '_self'); }
else{ // 現在を越えたら0が戻り停止
when_edge(); }}}
else{ // pageIDを含み 月のトップページでない場合
end=document.querySelector('.pagingArea .disabled.next');
if(!end){ // ページャーの末尾でなければ同月次ページへ
pageid=parseInt(win_url.slice(7).slice(0, -16), 10) +1;
next_url=
'https://blog.ameba.jp/ucs/entry/srventrylist.do?pageID='+ pageid + '&entry_ym=' + current;
window.open( next_url, '_self'); }
else{ // ページャーの末尾なら次月トップページへ
current=make_next(current);
if(current!=0){ // 現在を越えないなら次月へ
next_url=
'https://blog.ameba.jp/ucs/entry/srventrylist.do?entry_ym=' + current;
window.open( next_url, '_self'); }
else{ // 現在を越えたら0が戻り停止
when_edge(); }}}
function make_next(curr){
let ym;
let y;
let m;
ym=parseInt(curr, 10); // 10進数値化
y=Math.floor(ym/100); // 年は100で割った商
m=ym % 100; // 月は100で割った余り
if(m !=12){
ym=100*y + m +1; }
else{
ym=100*y + 101; }
let now=new Date();
if(ym > 100*now.getFullYear() + now.getMonth() +1){
return 0; } // 現在の月を越える場合は0を返す
else{
return ym; }} // 次年月の数値を返す
function when_edge(){
blogDB[0][1]='s'; // 連続動作フラグをリセット
let write_json=JSON.stringify(blogDB);
localStorage.setItem('EPW_DB_back', write_json); // ローカルストレージ保存
document.querySelector('#div0').remove();
document.querySelector('#div1').remove();
control_pannel('e'); } // 全作業の終了時の表示をさせる
} // next_call()
} // 親ウインドウの条件
})
「Every Page Worker 💢💢」最新版について
旧いバージョンの JavaScriptツールは、アメーバのページ構成の変更で動作しない場合があり、導入する場合は最新バージョンをお勧めします。
●「Every Page Worker 💢💢」の最新バージョンへのリンクは、以下のページのリンクリストから探せます。




