全てのアメーバブログ記事から編集を開始できる

「Edit At Once Am」は、あらゆるアメーバブログの記事を開いた状態から、ブログ記事の編集を開始できます。 これは使って判る、とても快適な環境です。 ツールを常駐すると、記事タイトルの右クリックで専用の編集メニューが表示されます。

  • 「再編集」は、開いている記事を再編集する画面を開きます。
  • 「新規作成」は、新しい記事を編集する編集画面を開きます。
  • 「リブログ」は、開いている記事のリブログ記事を編集する画面を開きます。
  • 「リスト表示」は、「記事の編集・削除」の画面を開き、開いていた記事を赤枠を着けて表示します。 そこで記事の複製・編集・削除が即時に可能です。

 

▶ 自分のブログ記事を開いている場合 

ユーザーが自分自身のブログ記事のタイトルを右クリックした時は、

「再編集」「新規作成」「リブログ」「リスト表示」の 4メニューが表示されます。

 

 

 

▶ 他ユーザーのブログ記事を開いている場合 

他ユーザーのブログの閲覧時に、記事タイトルを右クリックした時は、

「新規作成」「リブログ」の 2メニューが表示されます。

 

 

 

▶ アメンバー記事を開いている場合 

「再編集」「新規作成」「リブログ」「リスト表示」の 4メニューが表示されます。

(開いているユーザーをこの段階で判定出来ないので全メニューを表示します。 ただし、他ユーザーが「再編集」「リスト表示」を押しても実際は操作出来ません)

 

 

別画面を開くか、現在の画面を遷移するかを選択可能 

「Edit At Once Am」は基本的に「別タブ」で新しい画面を開きます。 しかし、場合によって現在の画面を遷移させ(置換えて)目的の画面を開きたい時があります。

 

その場合は、「Shift + 記事タイトルの右クリック」で、現在の画面を遷移させる動作を選択出来ます。 タブ画面を増やしたくない場合は「Shift」を使います。

「Shift」を押すとメニューがグレーに変化して、遷移動作をする事を示します。

 

 

 

本来のコンテキストメニューは「Ctrl + 記事タイトル右クリック」 

記事のタイトル部で、本来のブラウザの右クリックメニューを使いたい場合は、「Ctrl + 記事タイトルの右クリック」で、通常のコンテキストメニューが開きます。

 

 

 

「Ctrl」キーによる動作切換コードを改善しました 

キー押下判定コードの改善   の方針で、このツールのコードを改めました。 このツールの場合は、「Ctrl」「Shift」キーで「入れ子の判定コード」を使用していましたが、この判定コードを書き換えています。

 

 

 

「Edit At Once Am」ver. 1.31c の導入手順

「Edit At Once Am」は Chrome / Edge / Firefox の拡張機能「Tampermonkey」上で動作するスクリプトツールです。

 

❶「Tampermonkey」を導入します

使用しているブラウザに拡張機能「Tampermonkey」を導入する事が必要です。 以下のページに簡単な導入の説明をしていますから参照ください。 既にこの拡張機能を導入している場合は、❶ の操作は不要です。

 

 

❷「Tampermonkey」にスクリプトを登録します

「Tampermonkey」の「」マークの「新規スクリプト」タブを開きます。

 

 

 

◎「新規スクリプト」には、最初からテンプレートが記入されています。 これは全て削除して、完全に空白にした編集枠に 下のコードをコピー&ペーストします。

 

〔コピー方法〕 軽量シンプルなツール「PreBox Button   」を使うと

  コード枠内を「Ctrl+左Click」➔「Copy code 」を「左Click」

  の操作で、掲載コードのコピーが可能になります。

 

◎ 最後に「ファイル」メニューの「保存」を押すと、ツールが使用可能になります。

 

◎ 同系統のツール「Edit At Once」と同時ONでの使用ができます。

 

 

〔 Edit At Once Am 〕 ver. 1.31c

 

// ==UserScript==
// @name         Edit At Once Am
// @namespace    http://tampermonkey.net/
// @version      1.31c
// @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==


main();

let target=document.querySelector('head');
let monitor=new MutationObserver(main);
monitor.observe(target, { childList: true });

function main(){

    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 ctrl_f=0; // Ctrlキー 押下フラグ
        let owner=0; // 自分のブログの閲覧中のフラグ

        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){ // 専用メニュー表示
                    id_check();
                    if(ctrl_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"; }});}}


        function id_check(){
            let article=document.querySelector('.js-entryWrapper');
            let user=article.getAttribute('data-unique-ameba-id');
            let login_user_disp=document.querySelector('._3UwSsVVD'); // ヘッダーUSER名表示
            let amember=
                document.querySelector('[data-uranus-component="amemberLabel"]');

            if(!login_user_disp){
                if(!amember){
                    owner=0; } // ログインメニューが非表示の間は2メニューを表示
                else{
                    owner=1; }} // アメンバー記事の場合は4メニューを表示(ユーザー判定不能)
            else{
                if(login_user_disp.textContent==user){
                    owner=1; } // ユーザー自身のブログの場合は4メニューを表示
                else{
                    owner=0; }} // 他のユーザーのブログの場合は2メニューを表示

            if(owner==1){
                retouch.style.display='inline-block';
                file.style.display='inline-block'; }
            else{
                retouch.style.display='none';
                file.style.display='none'; }}


        document.addEventListener('keydown', function(event){
            if(event.ctrlKey){
                ctrl_f=1;
                if(title_h){
                    title_h.removeAttribute("onContextmenu", 'return false;'); }} // コンテキスト表示
            if(event.shiftKey){
                menu.classList.add('c_active'); }});

        document.addEventListener('keyup', function(event){
            ctrl_f=0;
            if(title_h){
                title_h.setAttribute("onContextmenu", 'return false;'); } // コンテキスト非表示
            menu.classList.remove('c_active'); });

        document.addEventListener('click', function(e){
            document.getElementById('eao_menu').style.display="none";
            ctrl_f=0;
            if(title_h){
                title_h.setAttribute("onContextmenu", 'return false;'); }}); // コンテキスト非表示


        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.shiftKey){
                    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.shiftKey){
                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.shiftKey){
                    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.shiftKey){
                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(); }}
    } //「編集画面」の場合

} // main()

 

 

 

「Edit At Once Am」最新版について 

旧いバージョンの JavaScriptツールは、アメーバのページ構成の変更で動作しない場合があり、導入する場合は最新バージョンをお勧めします。

 

●「Edit At Once Am」の最新バージョンへのリンクは、以下のページのリンクリストから探せます。