最後のブラシュアップです
機能の改善に注力して来ましたが、ほぼ完成の域に達したので、シリーズの3つのツールのデザインを、ブラシュアップしました。
下は「Every Page Opener 💢」ですが、このコントロール部は雛形となるパーツが殆ど揃っています。
◎年月セレクターの月数のフォントを14pxに変更(僅かに大きくなっています)、
また年月セレクターの幅を拡げました
◎月セレクタの選択枠のコードを変更し、配色もページャーに統一
◎ページャーはデフォルトの文字位置ズレを修正、フォントを14pxに変更
input要素のボタンデザイン
❶ ❷ は input要素で、独自のボタンデザインに変更できますが、途端にコード数が増えるので、デフォルトデザインを利用しています。 ❷ の「ファイルを選択」と「選択されていません」は、ボタン枠に対して文字が上にズレています。
しかし、デフォルトデザインを使う限りこれは修正できません。 ボタンの高さも不変で、❶ の方は paddingで文字位置が修正出来ますが、❷ に合わせるために制限されます。 ボタン上の文字位置は、この程度に調整できたらよしとしなければなりません。
Edgeの input要素のデザイン
ファイルを読込む input要素は、FirefoxとChromeは左側に「選択ボタン」がありますが、Edgeは右側です。 おまけにドライブ名ディレクトリ名ファイル名と全部表示するので、コントロール部の幅の割り当てでは肝心のファイル名が見えません。
これは半分諦めていたのですが、input要素に「direction: rtl」を指定すると、下の様にボタン位置が左側になり、右詰めでファイル名が読める様になりました。
シリーズのバージョンナンバーを揃えました
以上のブラシュアップをした「💢」シリーズのバージョンを、全て「2.4」としました。 以下は、「💢」シリーズの操作方法や情報のあるページの纏めです。
「Every Page Snap」の連続動作と停止方法
「Every Page Snap」のページデザインを更新しました
「Every Page Closer 💢」
SNAPに対応した最新の「Every Page Closer」
アメンバー記事処理を選択できる「Every Page Closer」
「Every Page Opener 💢」
SNAP対応をした「Every Page Opener」
「Every Page Opener」に非SNAP処理機能を追加
「💢」シリーズの最新コードの一覧
これらのツールは、Chrome / 新Edge / Firefox 各版の「Tampermonkey」にコピー&ペーストして利用できます。
〔コピー方法〕 軽量シンプルなツール「PreBox Button 」を使うと
コード枠内を「Ctrl+左Click」➔「Copy code 」を「左Click」
の操作で、掲載コードのコピーが可能になります。
アメブロ編集画面の「アメーバ限定公開」のボタン廃止に伴い、更新をしました
〔 Every Page Snap 💢 〕 ver. 2.4 N
// ==UserScript== // @name Every Page Snap 💢 // @namespace http://tampermonkey.net/ // @version 2.4 N // @description 「記事の編集・削除」ページで全記事の「公開設定」を記録する // @author Ameba Blog User // @match https://blog.ameba.jp/ucs/entry/srventrylist* // @run-at document-start // ==/UserScript== window.addEventListener('DOMContentLoaded', function(){ // CSSデザインを適用するためのスクリプト let css=[ 'html { overflow-y: overlay !important }', 'body { animation: fadeIn 0.2s ease 0s 1 normal }', '@keyframes fadeIn { 0% {opacity: 0} 100% {opacity: 1}}', '#globalHeader, #ucsHeader, #ucsMainLeft h1, .l-ucs-sidemenu-area, #ucsMainRight,', '#entryList dl, #entryList .deleteCol, #entryList .rightCol input, .actionControl,', '#footerAd, #globalFooter, .checkboxAllControl { display: none }', '#ucsContent{ width: 840px; box-shadow: 0 0 0 100vh #c5d8e1 }', '#ucsMain{ background: #fff } #ucsMainLeft { width: 810px; float: none }', '#entryList li{ height: 18px; padding: 6px 5px !important }', '#entryList li:hover{ background-color: #e2eef0 }', '#entryList .leftCol, #entryList .titleCol h2{ width: 560px }', '.leftCol a:hover{ text-decoration: none } .leftCol a:visited{ color: #3970b5 }', '#entryList .rightCol{ width: 225px }', '#entryList .txtCol .date{ font-size: 13px; color: #000 }', '#entryList .txtCol{ white-space: nowrap; font-size: 13px; margin-top: 2px; line-height: 16px }', '#entryList ul input[value="1"] + input + li .txtCol span:first-child{ display: inline-block;', 'margin-top: -2px; padding: 2px 13px 0; color: #fff; background: #2196f3 !important }', '#entryList ul input[value="2"] + input + li .txtCol span:first-child{ display: inline-block;', 'width: 3em; text-indent: -1em; overflow: hidden; margin-top: -2px; padding: 2px 13px 0;', 'vertical-align: -4px; color: #fff; background: #009688 !important }', '#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; padding: 4px; margin-bottom: -33px; background: #ddedf3 }', '.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: 38px 0 4px; padding: 4px 10px; height: 110px; background: #ddedf3 }', '#sorting select, #sorting ul { display: none }', 'input { font-family: meiryo; font-size: 14px }'].join(' '); let style=document.createElement('style'); style.insertAdjacentHTML('afterbegin', css); document.documentElement.appendChild(style); }) window.addEventListener('load', function(){ 'use strict'; let drive_mode; let blogDB={}; //「アメンバー公開」の記事IDリスト let entry_id; let entry_id_DB; let publish_f; let pub_all; let pub_dra; let pub_ame; 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('blogDB_back'); // ローカルストレージ 保存名 blogDB=JSON.parse(read_json); if(blogDB==null){ blogDB=[['00000000000', 's']]; } drive_mode=blogDB[0][1]; // 起動時に動作フラグを取得 if(drive_mode==0){ drive_mode='s'; } // 旧ファイルの救済 reg_set(); function reg_set(){ let k; entry_id_DB=[]; // リセット pub_all=0; pub_dra=0; pub_ame=0; for(k=0; k<blogDB.length; k++){ entry_id_DB[k]=blogDB[k][0]; // ID検索用の配列を作成 if(blogDB[k][1]=='0'){ pub_all +=1; continue; } if(blogDB[k][1]=='1'){ pub_dra +=1; continue; } if(blogDB[k][1]=='2'){ pub_ame +=1; continue; }}} control_pannel(drive_mode); function control_pannel(d){ let sty; let insert_div0; insert_div0=document.createElement('div'); insert_div0.setAttribute('id', 'div0'); insert_div0.style='color: #333; font-size: 14px; margin: 10px -10px 0 15px'; let box=document.querySelector('#sorting'); box.appendChild(insert_div0); let insert_div1; insert_div1=document.createElement('div'); insert_div1.setAttribute('id', 'div1'); insert_div1.style='color: #000; font-size: 14px; margin: 8px 15px; border: 1px solid #888'; box.appendChild(insert_div1); let button1=document.createElement('input'); button1.setAttribute('id', 'list_snap'); button1.setAttribute('type', 'submit'); button1.setAttribute('style', 'padding: 2px 0 0; margin: 7px 40px 7px 0; width: 210px'); insert_div0.appendChild(button1); if(d=='s'){ button1.setAttribute('value', '公開設定のSNAP開始 ▶'); button1.onclick=function(e){ e.preventDefault(); start(); } function start(){ let conf_str=[' 🔴 このページ以降の記事に関して 「公開設定」を記録します', '\n 連続動作はコントロール部にマウスに乗せると停止します'].join(' '); let ok=confirm(conf_str); if(ok){ blogDB[0][1]='c'; // 連続動作フラグをセット let write_json=JSON.stringify(blogDB); localStorage.setItem('blogDB_back', write_json); // ローカルストレージ 保存 next(); }}} else if(d=='c'){ // 「c」は連続動作 button1.setAttribute('value', ' SNAPを停止 ❚❚'); button1.style.pointerEvents='none'; button1.style.width='760px'; box.addEventListener('mouseover', function(e){ e.preventDefault(); box.setAttribute('style', 'background: #96b6d2'); stop(); }, false); function stop(){ blogDB[0][1]='s'; // 連続動作フラグをリセット let write_json=JSON.stringify(blogDB); localStorage.setItem('blogDB_back', write_json); } // ローカルストレージ 保存 setTimeout(next, 400); } // 連続実行のぺージ遷移のタイミング 0.4sec ⭕ else if(d=='e'){ // 「e」は終了 button1.setAttribute('value', 'SNAPが終了しました'); button1.style.pointerEvents='none'; box.addEventListener('mouseover', function(e){ e.preventDefault(); box.setAttribute('style', 'background: #ddedf3'); }, false); } if(d=='s' || d=='e'){ // 動作モードが「c」の場合はボタンを作らない let button2=document.createElement('input'); button2.setAttribute('id', 'reset'); button2.setAttribute('type', 'submit'); button2.setAttribute('value', '初期化'); button2.setAttribute('style', 'padding: 2px 0 0; margin-right: 20px; width: 60px'); insert_div0.appendChild(button2); button2.onclick=function(e){ e.preventDefault(); blogDB=[['00000000000', 's']]; let write_json=JSON.stringify(blogDB); localStorage.setItem('blogDB_back', write_json); // ローカルストレージ保存 snap_disp(); document.querySelector('#reset').value='〔 〕'; } let button3=document.createElement('input'); button3.setAttribute('type', 'submit'); button3.setAttribute('value', 'SNAPをファイル保存'); button3.setAttribute('style', 'padding: 2px 0 0; margin: 7px 10px 7px 0; width: 150px'); 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, 'blogDB.json'); } // 保存ファイル名 else{ let a_elem=document.createElement('a'); a_elem.href=URL.createObjectURL(blob); a_elem.download='blogDB.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: 285px'); 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)=='[["00000000000"'){ // blogDB.jsonの確認 let data_in=JSON.parse(file_reader.result); blogDB=data_in; // 読込み上書き処理 let write_json=JSON.stringify(blogDB); localStorage.setItem('blogDB_back', write_json); // ローカルストレージ 保存 button2.setAttribute('value', '初期化'); // 初期化後なら読み込んだ事を示す snap_disp(); } else{ alert(" ⛔ 不適合なファイルです blogDB(n).json ファイルを選択してください");}};});} let span5=document.createElement('span'); span5.setAttribute('id', 'snap_result'); span5.style='display: inline-block; margin: 6px 12px 4px'; insert_div1.appendChild(span5); snap_disp(); } function snap_disp(){ reg_set(); let span5=document.querySelector('#snap_result'); span5.textContent=' 記録件数:' + (blogDB.length -1) + ' 全員に公開:' + pub_all + ' アメンバー限定公開:' + pub_ame + ' 下書き:' + pub_dra; } function next(){ let win_url; let current; let pageid; let next_url; let pager; let end; entry_id=document.querySelectorAll('input[name="entry_id"]'); if(entry_id.length >0){ snap(); } // 投稿記事がある場合SNAPを実行 無ければスルーする 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].join(''); 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].join(''); 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].join(''); 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].join(''); 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('blogDB_back', write_json); // ローカルストレージ保存 document.querySelector('#div0').remove(); document.querySelector('#div1').remove(); control_pannel('e'); }} // SNAP終了時の表示をさせる function snap(){ // ページ内の「公開設定」をSNAPする let k; entry_id=document.querySelectorAll('input[name="entry_id"]'); publish_f=document.querySelectorAll('input[name="publish_flg"]'); for(k=0; k< entry_id.length; k++){ let index=entry_id_DB.indexOf(entry_id[k].value); if(index==-1){ // IDがblogDBに記録されていない場合 blogDB.push([entry_id[k].value, publish_f[k].value]); } // 公開設定の登録を追加 else{ // IDがblogDBに記録されていた場合 blogDB[index]=[entry_id[k].value, publish_f[k].value]; }} // 公開設定の登録を更新 setTimeout(write_local, 10); function write_local(){ let write_json=JSON.stringify(blogDB); localStorage.setItem('blogDB_back', write_json); }} // ローカルストレージ保存 })
アメブロ編集画面の「アメーバ限定公開」のボタン廃止に伴い、更新をしました
〔 Every Page Closer 💢 〕 ver. 2.4 N
// ==UserScript== // @name Every Page Closer 💢 // @namespace http://tampermonkey.net/ // @version 2.4 N // @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 css=[ '.include-ex-linkBtn, .save-browserPush, .save-hashtag-module, .adcrossBanner{ display: none }', 'html { overflow-y: overlay !important }', '#globalHeader, #ucsHeader, #ucsMainLeft h1, .l-ucs-sidemenu-area, #ucsMainRight,', '#entryList dl, #entryList .rightCol input, .actionControl,', '#footerAd, #globalFooter, .checkboxAllControl { display: none }', '#ucsContent{ width: 720px !important; box-shadow: 0 0 0 100vh #c5d8e1 }', '#ucsMain{ background: #fff } #ucsMainLeft { width: 690px !important; float: none }', '#entryList li{ height: 24px; padding: 8px 5px 5px !important }', '#entryList li:hover{ background-color: #e2eef0 }', '#entryList .leftCol, #entryList .titleCol h2{ width: 400px !important; line-height: 24px }', '.leftCol a:hover{ text-decoration: none } .leftCol a:visited{ color: #3970b5 }', '#entryList .rightCol{ display: flex; width: 260px !important }', '#entryList .txtCol .date{ font-size: 13px; color: #000 }', '#entryList .txtCol{ white-space: nowrap; font-size: 13px; margin-top: 4px; line-height: 16px }', '#entryList .deleteCol { margin: -3px 0 0 20px }', '.deleteCol a:nth-child(2), .deleteCol a:nth-child(3), .rightCol input { display: none }', '#entryList .btnDefault { height: 25px }', '#entryList .btnDefault:hover { box-shadow: inset 0 0 0px 2px #1976d2 }', '#entryList ul input[value="1"] + input + li .txtCol span:first-child{ display: inline-block;', 'margin-top: -2px; padding: 2px 13px 0; color: #fff; background: #2196f3 !important }', '#entryList ul input[value="2"] + input + li .txtCol span:first-child{ display: inline-block;', 'width: 3em; text-indent: -1em; overflow: hidden; margin-top: -2px; padding: 2px 13px 0;', 'vertical-align: -4px; color: #fff; background: #009688 !important }', '#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; padding: 4px; margin-bottom: -33px; background: #ddedf3 }', '.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: 38px 0 4px; padding: 4px 10px; height: 40px; background: #ddedf3 }', '#sorting select, #sorting ul { display: none }', 'input { font-family: meiryo; font-size: 14px }'].join(' '); let style=document.createElement('style'); style.insertAdjacentHTML('afterbegin', css); let head=document.getElementsByTagName('head')[0]; head.appendChild(style); }) window.addEventListener('load', function(){ // このスクリプトは孫ウインドウだけで働く let body_id=document.body.getAttribute('id'); if(body_id=="entryCreate"){ // この項だけ孫ウインドウで働く window.document.body.style.background='#c5d8e1'; window.document.body.style.boxShadow='0 0 0 100vh #c5d8e1'; window.document.querySelector('form').style.display='none'; select_e(close_w); function select_e(close_w){ let error_report=document.querySelector('h1.p-error__head'); if(error_report==null){ // 保存エラー無い場合 grayを送信 編集画面を閉じる if(window.opener){ report('gray'); window.opener.close(); }} else{ // 保存エラーのある場合は redを送信 編集画面を残す if(window.opener){ report('red'); window.opener.location.reload(); }} close_w(); } function close_w(){ window.open('about:blank','_self').close(); } // 孫ウインドウは常に閉じる function report(color){ window.opener.document.querySelector('html').style.color=color; }} }) window.addEventListener('load', function(){ // このスクリプトは親ウインドウで働くメインスクリプト let next; let mode; // 動作モード let am_process; //アメンバー記事処理 let mode_arr=[]; let entry_target; let publish_f; let list_bar; let new_win; let link_target; 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('blogDB_mode'); // ローカルストレージ 保存名 mode_arr=JSON.parse(read_json); if(!mode_arr || mode_arr.length!=3){ mode_arr=[0, 0, 0]; } mode=mode_arr[0]; // modeが「3」ならページングでぺージを開いた連続作業とみなす am_process=mode_arr[1]; // アメンバー記事処理の仕様は継承する mode_arr[0]=0; // 不正規の終了を考慮してリセット let write_json=JSON.stringify(mode_arr); localStorage.setItem('blogDB_mode', write_json); // ローカルストレージ保存 paging_watch(); function paging_watch(){ let k; let ym_pager=document.querySelectorAll('#entrySort a'); for(k=0; k<ym_pager.length; k++){ ym_pager[k].addEventListener('mousedown', function(){ mode_send(); }); } let pn_pager=document.querySelectorAll('.pagingArea a'); for(k=0; k<pn_pager.length; k++){ pn_pager[k].addEventListener('mousedown', function(){ mode_send(); }); } function mode_send(){ if(mode>0){ mode_arr[0]=3; //「0」以外から移動時の場合は「3」をローカルストレージ保存 mode_arr[1]=am_process; let write_json=JSON.stringify(mode_arr); localStorage.setItem('blogDB_mode', write_json); }}} // ローカルストレージ 保存 entry_target=document.querySelectorAll('.deleteCol'); publish_f=document.querySelectorAll('input[name="publish_flg"]'); list_bar=document.querySelectorAll('#entryList li'); let body_id=document.body.getAttribute('id'); if(body_id=='entryListEdit'){ // 親ウインドウの条件 let button1=document.createElement('input'); button1.setAttribute('id', 'start_button'); button1.setAttribute('type', 'submit'); button1.setAttribute('style', 'padding: 2px 8px 0; margin: 6px 15px; width: 200px'); let box=document.querySelector('#sorting'); box.appendChild(button1); button1.setAttribute('value', 'クローズ処理を開始 ▶'); button1.onclick=function(e){ e.preventDefault(); if(mode==0){ // 最初の起動直後 start_select(); } else if(mode==1){ // 続行状態 mode=2; // クリックされたら停止モード button1.setAttribute('value', 'クローズ処理を続行 ▶'); } else if(mode==2){ // 停止状態 mode=1; // クリックされたら続行モード button1.setAttribute('value', 'クローズ処理を停止 ❚❚'); open_win(next); } else if(mode==3){ // 前ページから連続作業で開いた状態 if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合 alert('このページに編集対象の記事がありません'); } // クリックで modeは「3」のまま else if(entry_target.length >0){ // 編集対象がリストに有る場合 mode=1; // クリックされたら続行モード button1.setAttribute('value', 'クローズ処理を停止 ❚❚'); open_win(0); }}} // 連続作業でスタート function start_select(){ if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合 alert('このページに編集対象の記事がありません'); } if(entry_target.length >0){ // 編集対象がリストに有る場合 let conf_str=['⛔ このページの全ての記事を 「下書き」 に変更します。\n', '\n Every Page Closer 💢 の実行前に Every Page Snap 💢', '\n を実行して、全ての記事の 「公開設定」 を記録してください。', '\n 「公開設定」 のSNAP記録が無いと 「アメンバー限定公開」 と', '\n 「全員に公開」 の区別がなくなり 公開処理が困難になります。\n', '\n OK を押すと 「クローズ処理」 を開始します。'].join(''); let ok=confirm(conf_str); if(ok){ mode=1; button1.setAttribute('value', 'クローズ処理を停止 ❚❚'); open_win(0); }}} let button2=document.createElement('input'); button2.setAttribute('id', 'am_button'); button2.setAttribute('type', 'submit'); button2.setAttribute('style', 'padding: 2px 8px 0; margin: 6px 15px; width: 250px; float: right'); box.appendChild(button2); if(am_process==0){ button2.setAttribute('value', '🔽 アメンバー記事もクローズする'); } else if(am_process==1){ button2.setAttribute('value', '⬜ アメンバー記事は処理をしない'); } button2.onclick=function(e){ e.preventDefault(); if(am_process==0){ am_process=1; button2.setAttribute('value', '⬜ アメンバー記事は処理をしない'); } else if(am_process==1){ am_process=0; button2.setAttribute('value', '🔽 アメンバー記事もクローズする'); } mode_arr[1]=am_process; let write_json=JSON.stringify(mode_arr); localStorage.setItem('blogDB_mode', write_json); }} function open_win(k){ new_win=Array(entry_target.length); link_target=Array(entry_target.length); link_target[k]=entry_target[k].getElementsByTagName('a')[0].getAttribute('href'); let top_p=100 + 30*k; if(mode==1){ if(publish_f[k].value=='0' || (publish_f[k].value=='2' && am_process==0)){ // クローズ処理をする new_win[k]=window.open(link_target[k], k, 'top=' + top_p + ', left=200, width=750, height=180'); list_bar[k].style.boxShadow='inset 0 0 0 2px #03a9f4'; // リスト欄に青枠表示 new_win[k].addEventListener('load', function(){ setTimeout( function(){ edit_target(publish_f[k].value, k); }, 50); });} // 子ウインドウで書込み開始 🟦 else{ list_bar[k].style.backgroundColor='#eceff1'; next_do(k); }}} //⏩ 子ウインドウを開かず リスト背景 淡グレー function edit_target(val,k){ new_win[k].addEventListener('beforeunload', flag_line , false); publish_do(val,k); function flag_line(){ let send_color=new_win[k].document.querySelector('html').style.color; if(send_color=='gray'){ // 文書保存が正常終了した場合 リスト背景 淡ブルー list_bar[k].style.boxShadow='none'; list_bar[k].style.backgroundColor='#a4d5fd'; let publish_f_tetCol=list_bar[k].querySelector('.txtCol span:first-child'); let sty=['display: inline-block; margin-top: -2px; padding: 2px 13px 0;', 'color: #fff; background: #2196f3 !important; text-indent: 0'].join(' '); publish_f_tetCol.textContent='下書き'; publish_f_tetCol.style=sty; next_do(k); } //⏩ else if(send_color=='red'){ // 文書保存が異常終了の場合は編集画面は閉ず リスト背景白 赤枠表示 list_bar[k].style.boxShadow='inset 0 0 0 2px red'; list_bar[k].style.backgroundColor='#fff'; next_do(k); }} //⏩ function publish_do(val,k){ let publish_b0=new_win[k].document.querySelector('button.js-submitButton[publishflg="0"]'); let publish_b1=new_win[k].document.querySelector('button.js-submitButton[publishflg="1"]'); if(val==0){ publish_b1.click(); } //「公開記事」→「下書き」の書換え実行 if(val==1){ publish_b1.click(); } if(val==2){ publish_b1.click(); }}} //「アメンバー公開記事」→「下書き」の書換え実行 function next_do(k){ next=k+1; if(next<entry_target.length){ open_win(next); } else{ mode=4; // 終了状態 let button1=document.querySelector('#start_button'); button1.setAttribute('value', '処理が終りました'); }} })
アメブロ編集画面の「アメーバ限定公開」のボタン廃止に伴い、更新をしました
〔 Every Page Opener 💢 〕 ver. 2.4 N
// ==UserScript== // @name Every Page Opener 💢 // @namespace http://tampermonkey.net/ // @version 2.4 N // @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 css=[ '.include-ex-linkBtn, .save-browserPush, .save-hashtag-module, .adcrossBanner{ display: none }', 'html { overflow-y: overlay !important }', '#globalHeader, #ucsHeader, #ucsMainLeft h1, .l-ucs-sidemenu-area, #ucsMainRight,', '#entryList dl, #entryList .rightCol input, .actionControl,', '#footerAd, #globalFooter, .checkboxAllControl { display: none }', '#ucsContent{ width: 720px !important; box-shadow: 0 0 0 100vh #c5d8e1 }', '#ucsMain{ background: #fff } #ucsMainLeft { width: 690px !important; float: none }', '#entryList li{ height: 24px; padding: 8px 5px 5px !important }', '#entryList li:hover{ background-color: #e2eef0 }', '#entryList .leftCol, #entryList .titleCol h2{ width: 400px !important; line-height: 24px }', '.leftCol a:hover{ text-decoration: none } .leftCol a:visited{ color: #3970b5 }', '#entryList .rightCol{ display: flex; width: 260px !important }', '#entryList .txtCol .date{ font-size: 13px; color: #000 }', '#entryList .txtCol{ white-space: nowrap; font-size: 13px; margin-top: 4px; line-height: 16px }', '#entryList .deleteCol { margin: -3px 0 0 20px }', '.deleteCol a:nth-child(2), .deleteCol a:nth-child(3), .rightCol input { display: none }', '#entryList .btnDefault { height: 25px }', '#entryList .btnDefault:hover { box-shadow: inset 0 0 0px 2px #1976d2 }', '#entryList ul input[value="1"] + input + li .txtCol span:first-child{ display: inline-block;', 'margin-top: -2px; padding: 2px 13px 0; color: #fff; background: #2196f3 !important }', '#entryList ul input[value="2"] + input + li .txtCol span:first-child{ display: inline-block;', 'width: 3em; text-indent: -1em; overflow: hidden; margin-top: -2px; padding: 2px 13px 0;', 'vertical-align: -4px; color: #fff; background: #009688 !important }', '#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; padding: 4px; margin-bottom: -33px; background: #ddedf3 }', '.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: 38px 0 4px; padding: 4px 10px; height: 110px; background: #ddedf3 }', '#sorting select, #sorting ul { display: none }', 'input { font-family: meiryo; font-size: 14px }'].join(' '); let style=document.createElement('style'); style.insertAdjacentHTML('afterbegin', css); let head=document.getElementsByTagName('head')[0]; head.appendChild(style); }) window.addEventListener('load', function(){ // このスクリプトは孫ウインドウだけで働く let body_id=document.body.getAttribute('id'); if(body_id=="entryCreate"){ // この項だけ孫ウインドウで働く window.document.body.style.background='#c5d8e1'; window.document.body.style.boxShadow='0 0 0 100vh #c5d8e1'; window.document.querySelector('#subContentsArea').style.display='none'; select_e(close_w); function select_e(close_w){ let error_report=document.querySelector('h1.p-error__head'); if(error_report==null){ // エラー無い場合 grayを送信 親ウインドウを閉じる if(window.opener){ report('gray'); window.opener.close(); }} else{ // エラー報告の場合 redを送信 親ウインドウを残す if(window.opener){ report('red'); window.opener.location.reload(); }} close_w(); } function close_w(){ window.open('about:blank','_self').close(); } // 孫ウインドウは常に閉じる function report(color){ window.opener.document.querySelector('html').style.color=color; }} }) window.addEventListener('load', function(){ // このスクリプトは親ウインドウで働くメインスクリプト let next; let mode; // 動作モード let except_am; //「アメンバー記事」以外を開く特別モード let mode_arr=[]; let blogDB={}; // 記事IDリスト let entry_id_DB=[]; // ID検索用の配列 let filter; let regex_id; let entry_target; let entry_id; let publish_f; let pub_all; let pub_dra; let pub_ame; let list_bar; let new_win; let link_target; 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('blogDB_back'); // ローカルストレージ 保存名 blogDB=JSON.parse(read_json); // blogDB(SNAP記録)はこのスクリプトでは読取り専用 if(blogDB==null){ blogDB=[['00000000000', 's']]; } else{ reg_set(); } function reg_set(){ let k; entry_id_DB=[]; // リセット pub_all=0; pub_dra=0; pub_ame=0; for(k=0; k<blogDB.length; k++){ entry_id_DB[k]=blogDB[k][0]; // ID検索用の配列を作成 if(blogDB[k][1]=='0'){ pub_all +=1; continue; } if(blogDB[k][1]=='1'){ pub_dra +=1; continue; } if(blogDB[k][1]=='2'){ pub_ame +=1; continue; }} filter=entry_id_DB.join('|'); regex_id=RegExp(filter); } // フィルター作成 read_json=localStorage.getItem('blogDB_mode'); // ローカルストレージ 保存名 mode_arr=JSON.parse(read_json); if(!mode_arr || mode_arr.length!=3){ mode_arr=[0, 0, 0]; } mode=mode_arr[0]; // modeが「3」ならページングでぺージを開いた連続作業とみなす except_am=mode_arr[2]; //「アメンバー記事」以外を開く特別モード mode_arr[0]=0; // 不正規の終了を考慮してリセット let write_json=JSON.stringify(mode_arr); localStorage.setItem('blogDB_mode', write_json); // ローカルストレージ保存 paging_watch(); function paging_watch(){ let k; let ym_pager=document.querySelectorAll('#entrySort a'); for(k=0; k<ym_pager.length; k++){ ym_pager[k].addEventListener('mousedown', function(){ mode_send(); }); } let pn_pager=document.querySelectorAll('.pagingArea a'); for(k=0; k<pn_pager.length; k++){ pn_pager[k].addEventListener('mousedown', function(){ mode_send(); }); } function mode_send(){ // 「0」以外から移動時の場合は「3」をローカルストレージ保存 if(mode>0){ mode_arr[0]=3; let write_json=JSON.stringify(mode_arr); localStorage.setItem('blogDB_mode', write_json); }}} // ローカルストレージ 保存 entry_target=document.querySelectorAll('.deleteCol'); entry_id=document.querySelectorAll('input[name="entry_id"]'); publish_f=document.querySelectorAll('input[name="publish_flg"]'); list_bar=document.querySelectorAll('#entryList li'); let body_id=document.body.getAttribute('id'); if(body_id=='entryListEdit'){ // 親ウインドウでのみ働く let sty; let insert_div0; insert_div0=document.createElement('div'); insert_div0.setAttribute('id', 'div0'); insert_div0.style='color: #333; font-size: 14px; margin: 10px -10px 0 15px'; let box=document.querySelector('#sorting'); box.appendChild(insert_div0); let insert_div1; insert_div1=document.createElement('div'); insert_div1.setAttribute('id', 'div1'); insert_div1.style='color: #000; font-size: 14px; margin: 8px 15px; border: 1px solid #888'; box.appendChild(insert_div1); let button1=document.createElement('input'); button1.setAttribute('id', 'start_button'); button1.setAttribute('type', 'submit'); button1.setAttribute('style', 'padding: 2px 8px 0; margin: 7px 35px 7px 0; width: 160px'); insert_div0.appendChild(button1); button1.setAttribute('value', '公開処理の開始 ▶'); button1.onclick=function(e){ e.preventDefault(); if(mode==0){ // 最初の起動直後 if(except_am==0){ // 特別オープンモードOFF start_select(); } else if(except_am==1){ // 特別オープンモードON start_select_ex(); }} else if(mode==1){ // 続行状態 mode=2; // クリックされたら停止モード button1.setAttribute('value', '公開処理を続行 ▶'); } else if(mode==2){ // 停止状態 mode=1; // クリックされたら続行モード button1.setAttribute('value', '公開処理を停止 ❚❚'); open_win(next); } else if(mode==3){ // 前ページから連続作業で開いた状態 if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合 alert('このページに編集対象の記事がありません'); } // クリックで modeは「3」のまま else if(entry_target.length >0){ // 編集対象がリストに有る場合 mode=1; // クリックされたら続行モード button1.setAttribute('value', '公開処理を停止 ❚❚'); open_win(0); }}} // 連続作業でスタート function start_select(){ if(blogDB.length==1){ alert(['⛔ SNAPデータを blogDB(n).json ファイルから読込んでください。', '\n Every Page Snap 💢 で作成した適切なファイルが無い場合は', '\n Every Page Opener を使用して公開処理をしてください。', '\n\n⛔ 〔注意〕', '\n Every Page Opener は 元 「アメンバー記事」 から 「下書き」 に', '\n 変更処理をした記事に関しても 「全員に公開」 に変更します。', '\n この点には注意して下さい。 このツールを終了します'].join('') ); } else if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合 alert('このページに編集対象の記事がありません'); } else if(entry_target.length >0){ // 編集対象がリストに有る場合 let conf_str=['🟠 このページの 「下書き」 を SNAPデータに従って公開処理します\n', '\n SNAP時の 「全員公開」の記事 ➡ 「全員に公開」', '\n SNAP時の 「アメンバー記事」 ➡ 「アメンバー限定公開」', '\n 現在の 「アメンバー限定公開」 は 変更しません', '\n SNAPデータに記録がない記事は 変更しません \n', '\n OKを押すと公開処理を開始します'].join(''); let ok=confirm(conf_str); if(ok){ mode=1; button1.setAttribute('value', '公開処理を停止 ❚❚'); open_win(0); }}} function start_select_ex(){ if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合 alert('このページに編集対象の記事がありません'); } else if(entry_target.length >0){ // 編集対象がリストに有る場合 let conf_str=['🟠 このページの 「下書き」 を SNAPデータなしで公開処理します\n', '\n 元の 「全員公開」「アメンバー記事」 ➡ 「全員に公開」', '\n 現在の 「アメンバー記事」「全員公開」 は変更しません\n', '\n OKを押すと公開処理を開始します'].join(''); let ok=confirm(conf_str); if(ok){ mode=1; button1.setAttribute('value', '公開処理を停止 ❚❚'); open_win(0); }}} if(except_am==0){ // 特別オープンモードOFFの場合のみ表示 let button2=document.createElement('input'); button2.setAttribute('type', 'file'); button2.setAttribute('style', 'vertical-align: 1px; width: 300px'); if(ua==2){ button2.setAttribute('style', 'vertical-align: 0; width: 300px; direction: rtl'); } insert_div0.appendChild(button2); button2.addEventListener("change", function(){ if(!(button2.value)) return; // ファイルが選択されない場合 let file_list=button2.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)=='[["00000000000"'){ // blogDB.jsonの確認 let data_in=JSON.parse(file_reader.result); blogDB=data_in; // 読込み上書き処理 let write_json=JSON.stringify(blogDB); localStorage.setItem('blogDB_back', write_json); // ローカルストレージ 保存 reg_set(); time_disp(new Date(file.lastModified)); snap_disp(); } else{ alert(" ⛔ 不適合なファイルです blogDB(n).json ファイルを選択してください");}};}); let span1=document.createElement('span'); span1.setAttribute('id', 'span1'); let sty2=['display: inline-block; font-size: 14px; color: #000;', 'width: 140px; padding: 3px 0 2px 12px'].join(' '); span1.setAttribute('style', sty2); insert_div0.appendChild(span1); span1.textContent=' '; function time_disp(time_obj){ let date_sty=time_obj.getFullYear() + "/" + (time_obj.getMonth() + 1) + "/" + time_obj.getDate() + " " + time_obj.getHours() + ":" + time_obj.getMinutes(); span1.textContent=date_sty; }} let span5=document.createElement('span'); span5.setAttribute('id', 'snap_result'); span5.style='display: inline-block; margin: 6px 12px 4px'; insert_div1.appendChild(span5); if(except_am==0){ // 特別オープンモードOFFの場合のみ表示 snap_disp(); } function snap_disp(){ reg_set(); let span5=document.querySelector('#snap_result'); span5.textContent=' 記録件数:' + (blogDB.length -1) + ' 全員に公開:' + pub_all + ' アメンバー限定公開:' + pub_ame + ' 下書き:' + pub_dra; } let span6=document.createElement('span'); span6.setAttribute('id', 'am_button'); span6.style='display: inline-block; margin: 6px 15px 0; float: right; cursor: pointer'; insert_div1.appendChild(span6); if(except_am==0){ // 特別オープンモードOFF span6.textContent='🔽'; span5.style='display: inline-block; margin: 6px 12px 4px'; } else if(except_am==1){ // 特別オープンモードON span6.textContent='🟩'; span5.style='display: inline-block; margin: 6px 12px 4px 60px'; span5.textContent='◼◼◼◼◼ 現在のアメンバー記事以外を 全員に公開します ◼◼◼◼◼'; } span6.onclick=function(e){ e.preventDefault(); if(except_am==0){ // 特別オープンモードOFF except_am=1; } else if(except_am==1){ // 特別オープンモードON except_am=0; } mode_arr[2]= except_am; write_json=JSON.stringify(mode_arr); localStorage.setItem('blogDB_mode', write_json); // ローカルストレージ保存 location.reload(); }} // 特別オープンモードの変更時はリロードする function open_win(k){ new_win=Array(entry_target.length); link_target=Array(entry_target.length); link_target[k]=entry_target[k].getElementsByTagName('a')[0].getAttribute('href'); let top_p=100 + 30*k; if(mode==1 && except_am==0){ // 特別オープンモードOFF let index=entry_id_DB.indexOf(entry_id[k].value); if(index==-1){ // IDが SNAPデータに記録がない記事の場合 list_bar[k].style.backgroundColor='#fff5aa'; next_do(k); } //⏩ 子ウインドウを開かず リスト背景 黄色 else{ // IDがSNAPデータに記録されていた場合 if(publish_f[k].value==1){ // リスト上の公開設定が「下書き」のみ処理 if(blogDB[index][1]==1){ // SNAPデータが「下書き」の場合 list_bar[k].style.backgroundColor='#eceff1'; next_do(k); } //⏩ 子ウインドウを開かず リスト背景 淡グレー else{ publish_f[k].value=blogDB[index][1]; // リスト上の公開設定をSNAPデータに従って更新する new_win[k]=window.open(link_target[k], k, 'top=' + top_p + ', left=200, width=750, height=180'); // 編集画面を開く let publish_f_tetCol=list_bar[k].querySelector('.txtCol span:first-child'); publish_f_tetCol.style='padding: 2px 13px 0; opacity: 0'; list_bar[k].style.boxShadow='inset 0 0 0 2px #03a9f4'; // リスト 青枠表示 new_win[k].addEventListener('load', function(){ setTimeout( function(){ edit_target(publish_f[k].value, k); }, 50); });}} //🟦 子ウインドウで書込み開始 else{ // リスト上の公開設定が「下書き」ではない場合 list_bar[k].style.backgroundColor='#eceff1'; next_do(k); }}} //⏩ 子ウインドウを開かず リスト背景 淡グレー if(mode==1 && except_am==1){ // 特別オープンモードON if(publish_f[k].value==1){ // リスト上の公開設定が「下書き」のみ処理 publish_f[k].value=0; //「全員に公開」に設定更新する new_win[k]=window.open(link_target[k], k, 'top=' + top_p + ', left=200, width=750, height=180'); // 編集画面を開く let publish_f_tetCol=list_bar[k].querySelector('.txtCol span:first-child'); publish_f_tetCol.style='padding: 2px 13px 0; opacity: 0'; list_bar[k].style.boxShadow='inset 0 0 0 2px #03a9f4'; // リスト 青枠表示 new_win[k].addEventListener('load', function(){ setTimeout( function(){ edit_target(publish_f[k].value, k); }, 50); });} //🟦 子ウインドウで書込み開始 else{ // リスト上の公開設定が「下書き」ではない場合 list_bar[k].style.backgroundColor='#eceff1'; next_do(k); }}} function edit_target(val,k){ new_win[k].addEventListener('beforeunload', flag_line, false); publish_do(val,k); function flag_line(){ if(new_win[k]){ var send_color=new_win[k].document.querySelector('html').style.color; } if(send_color=='gray'){ // 文書保存が正常終了した場合 list_bar[k].style.boxShadow='none'; // 青枠を消す list_bar[k].style.backgroundColor='#a4d5fd'; // 子ウインドウが閉じられ リスト背景 淡ブルー let publish_f_tetCol=list_bar[k].querySelector('.txtCol span:first-child'); if(publish_f[k].value==0){ //「全員に公開」へ処理した場合 let sty=['display: inline-block; margin-top: -2px; padding: 2px 0 0;', 'color: #000; background: #fff !important; opacity: 1'].join(' '); publish_f_tetCol.textContent='全員に公開'; publish_f_tetCol.style=sty; } else if(publish_f[k].value==2){ //「アメンバー限定公開」へ処理した場合 let sty=['padding: 2px 13px 0;', 'color: #fff; background: #009688 !important; opacity: 1'].join(' '); publish_f_tetCol.textContent='アメンバー'; publish_f_tetCol.style=sty; } next_do(k); } // ⏩ else if(send_color=='red'){ // 文書保存が異常終了の場合は子ウインドウは閉じない list_bar[k].style.boxShadow='inset 0 0 0 2px red'; // リスト 背景 白 赤枠表示 list_bar[k].style.backgroundColor='#fff'; next_do(k); }} // ⏩ function publish_do(val, k){ let publish_b0=new_win[k].document.querySelector('button.js-submitButton[publishflg="0"]'); let publish_b1=new_win[k].document.querySelector('button.js-submitButton[publishflg="1"]'); if(val==0){ publish_b0.click(); } if(val==1){ publish_b1.click(); } if(val==2){ let amb_ck=new_win[k].document.querySelector('#amemberFlg'); amb_ck.checked = true; setTimeout(()=>{ publish_b0.click(); }, 20); }}} function next_do(k){ next=k+1; if(next<entry_target.length){ open_win(next); } else{ mode=4; // 終了状態 let button1=document.querySelector('#start_button'); button1.setAttribute('value', '処理が終りました'); }} })