「Edit At Once Am」は編集・再編集を加速する
このツールは、「ブログ記事を書き始める」「ブログ記事を再編集する」「リブログ記事を書く」「過去記事のコピーを再編集する」といった作業を、自他のブログページから最短距離で開始する事を可能にします。
「Am」はアメンバー記事にも対応した時点からのネーミングですが、このツールはブログ記事のタイトルの右クリックから起動します。 扱いは、以下を参照ください。
「Edit At Once Am」Ctrlで「元画面を閉じる」を指定
「タイル・リスト型」のトップページでのエラーを抑止
スクリプトエラーはブラウザ動作に現れない事が多く、なかなか気付けない場合があります。 今回は、他のスクリプトのテストで気付いたエラーで、以下のサンプル画面の様に、100を超えるエラーが一瞬に出ていました。
このページは「リスト型」のブログトップページで、記事タイトルが無いために、エラーが出ていました。
「タイル型」「リスト型」のトップページのブログスキンを使うユーザーは余り多くなく、アメブロ内からはトップページを開く事が少ないので、この状態になる事は少ないと思います。 ブラウザの動作に問題は感じられませんが、不細工なので、エラー抑止対策をしたコードをアップロードします。
「Edit At Once Am」の導入手順
❶「Tampermonkey」を導入します
使用しているブラウザに拡張機能「Tampermonkey」の導入が必要です。 以下のページに簡単な導入の説明をしていますから参照ください。
●「Edit At Once Am」は、Chrome / 新Edge / Firefox の「Tampermonkey」で動作を確認しています。 他のブラウザ環境での動作に関しては、成否を問わずコメントいただければ幸いです。
❷「Tampermonkey」にスクリプトを登録します
「Tampermonkey」の「+」マークの「新規スクリプト」タブを開きます。
●「新規スクリプト」には、最初からテンプレートが記入されています。 これは全て削除して、完全に空白の編集枠に 下のコードをコピー&ペーストします。
〔コピー方法〕 軽量シンプルなツール「PreBox Button 」を使うと
コード枠内を「Ctrl+左Click」➔「Copy code 」を「左Click」
の操作で、掲載コードのコピーが可能になります。
● 旧バージョンはOFFにするか削除をして、新旧の同時ONは避けてください。
なお、同系統のツール「Edit At Once ⭐」とは同時ONでの使用ができます。
〔 Edit At Once Am 〕 ver. 1.01
// ==UserScript== // @name Edit At Once Am // @namespace http://tampermonkey.net/ // @version 1.01 // @description Edit Entry_ID Page // @author Ameba Blog User // @match https://ameblo.jp/* // @match https://secret.ameba.jp/* // @match https://blog.ameba.jp/ucs/entry/srventry* // @noframes // @grant none // ==/UserScript== icon_click(); let target=document.querySelector('head'); let monitor=new MutationObserver(icon_click); monitor.observe(target, { childList: true }); function icon_click(){ if(!document.querySelector('#entryListEdit') && !document.querySelector('.l-body')){ //「記事の編集・削除」「編集画面」でない場合 let menu=document.createElement('div'); menu.innerHTML= '<span id="retouch">再編集</span> '+ '<span id="newwork">新規作成</span> '+ '<span id="reblog">リブログ</span>'+ '<span id="file">リスト表示</span>'+ '<style>#eao_menu { position: absolute; z-index: 20; font: normal 14px Meiryo; '+ 'padding: 3px 10px 1px; border: 1px solid #dadce0; color: #333; background: #fff; '+ 'box-shadow: 4px 4px 2px -2px rgba(0, 0, 0, 0.48); cursor: default; } '+ '#eao_menu span { padding: 1px 4px 0; } '+ '#eao_menu span:hover { color: #fff; background: #2196f3; } '+ '#eao_menu.c_active span:hover { background: #90a4ae; }</style>'; menu.setAttribute("id", 'eao_menu'); menu.style.display='none'; if(!document.getElementById('eao_menu')){ document.querySelector('body').appendChild(menu); } let article=document.querySelector('.js-entryWrapper'); //記事全体 let title_h; // タイトル部 let title; // 記事タイトル let shift_f=0; // shiftキー 押下フラグ if(article){ if(article.querySelector('h1')){ title_h=article.querySelector('h1'); title=title_h.querySelector('a'); } else if(article.querySelector('h2')){ title_h=article.querySelector('h2'); title=title_h.querySelector('a'); } else if(article.querySelector('h3')){ title_h=article.querySelector('h3'); title=title_h.querySelector('a'); } if(title){ title_h.setAttribute("onContextmenu", 'return false;'); // コンテキスト非表示 title.addEventListener('contextmenu', function(e){ if(shift_f==0){ document.getElementById('eao_menu').style.display="block"; document.getElementById('eao_menu').style.left=e.pageX+"px"; document.getElementById('eao_menu').style.top=e.pageY+"px"; }});}} document.body.addEventListener('keydown', function(event){ if(event.shiftKey==true){ shift_f=1; if(title_h){ title_h.removeAttribute("onContextmenu", 'return false;'); } // コンテキスト表示 document.body.addEventListener('keyup', function(event){ shift_f=0; // コンテキスト非表示 if(title_h){ title_h.setAttribute("onContextmenu", 'return false;'); }});}}); document.body.addEventListener('click', function(e){ document.getElementById('eao_menu').style.display="none"; shift_f=0; if(title_h){ title_h.setAttribute("onContextmenu", 'return false;'); }}); // コンテキスト非表示 document.body.addEventListener('keydown', function(event){ if(event.ctrlKey==true){ menu.classList.add('c_active'); document.body.addEventListener('keyup', function(event){ menu.classList.remove('c_active'); });}}); let retouch=document.getElementById('retouch'); retouch.onclick=function(event){ let article=document.querySelector('.js-entryWrapper'); let entry_id=article.getAttribute('data-unique-entry-id'); if(entry_id){ let path= 'https://blog.ameba.jp/ucs/entry/srventryupdateinput.do?id='+entry_id; if(event.ctrlKey!=true){ window.open(path, "_blank"); } else{ window.location.href=path; }}} let newwork=document.getElementById('newwork'); newwork.onclick=function(){ let path='https://blog.ameba.jp/ucs/entry/srventryinsertinput.do'; if(event.ctrlKey!=true){ window.open(path, "_blank"); } else{ window.location.href=path; }} let reblog=document.getElementById('reblog'); reblog.onclick=function(){ let article=document.querySelector('.js-entryWrapper'); let user=article.getAttribute('data-unique-ameba-id'); let titil_str=article.getAttribute('data-unique-entry-title'); let entry_id=article.getAttribute('data-unique-entry-id'); if(user && entry_id){ let path= 'https://blog.ameba.jp/ucs/entry/srventryinsertinput.do?'+ 'reblog_ameba_id='+user+'&reblog_entry_id='+entry_id+ '&entry_title='+titil_str; if(event.ctrlKey!=true){ window.open(path, "_blank"); } else{ window.location.href=path; }}} let file=document.getElementById('file'); file.onclick=function(){ let article=document.querySelector('.js-entryWrapper'); let user=article.getAttribute('data-unique-ameba-id'); let entry_id=article.getAttribute('data-unique-entry-id'); let date=document.querySelector('time').getAttribute('datetime'); let entry_ym=date.slice(0, 4) + date.slice(5, 7); let path= 'https://blog.ameba.jp/ucs/entry/srventrylist.do?pageID='+ '1&entry_ym='+entry_ym+'&user='+user+'&entry_id='+entry_id; if(event.ctrlKey!=true){ window.open(path, "_blank"); } else{ window.location.href=path; }} } //「記事の編集・削除」「編集画面」でない場合 if(document.querySelector('#entryListEdit')){ //「記事の編集・削除」の場合 let arg = new Object; let pair=location.search.substring(1).split('&'); for(let i=0; pair[i]; i++){ let key=pair[i].split('='); arg[key[0]]=key[1]; } // key[0]がkey, key[1]がvalue let entry_ym=arg.entry_ym; let pageID=parseInt( arg.pageID, 10); // 数値に変換 let user=arg.user; let entry_id=arg.entry_id; let amebaId=document.querySelector('#gHeaderRight .amebaId').textContent; let entryList_li=document.querySelectorAll('#entryList li'); if(user!=null){ if(amebaId!=user){ // 他ユーザーのブログでリスト表示を押した場合 if(history.length>1){ window.history.back(); } else{ window.close(); }} else{ let k; for(k=0; k<entryList_li.length; k++){ let entryList_a=entryList_li[k].querySelector('h2 a'); if(entryList_a){ if(entryList_a.getAttribute('href').indexOf(entry_id)!=-1){ entryList_li[k].style.outline='2px solid red'; entryList_li[k].scrollIntoView({block: "center"}); break; }}} if(k==entryList_li.length){ pageID+=1; let path= 'https://blog.ameba.jp/ucs/entry/srventrylist.do?pageID='+ pageID+'&entry_ym='+entry_ym+'&user='+user+'&entry_id='+entry_id; window.location.href=path; }}} } //「記事の編集・削除」の場合 if(document.querySelector('.l-body')){ //「編集画面」の場合 if(document.querySelector('.l-form form > .error')){ // 他ユーザで再編集を押した場合 if(history.length>1){ window.history.back(); } else{ window.close(); }} } //「編集画面」の場合 } // icon_click()
「Edit At Once Am」最新版について
旧いバージョンの JavaScriptツールは、アメーバのページ構成の変更で動作しない場合があり、導入する場合は最新バージョンをお勧めします。
●「Edit At Once Am」の最新バージョンへのリンクは、以下のページのリンクリストから探せます。