記事末尾に常設「styleタグ」を一括で記入

「Every Page」は常設「styleタグ」を記事末尾に一括で記入します。 このツールはブログのスマホアプリでの表示を見据えた、メンテナンスツールです。

 

 

 

「Every Page」ver.1.1 の操作について

 

「Every Page」をONにする前に 

● ブラウザのポップアップブロック設定が有効になっていると正常な動作を妨げられます。 以下のページ末尾のブロック解除の設定方法に従い「https://blog.ameba.jp」を解除URLに追加してください。

 

  クリックで新しいタブを開く「リブログ」 

 

▪ Firefoxで使用する際は、ブラウザの「オプション」→「タブグループ」の設定で、「新しいウィンドウではなく新しいタブに開く」を指定してください。

 

●「Every Page」をONにする際は、他のブログ編集画面、ブラウザの他画面などを閉じておきます。

 

● 同類ツールの「Every Page Plain」「Every Page Checker」「Auto Style Attach」はOFFにしておく事が必須です。 ブログ編集画面で動作する JavaScriptツールも OFFにしておくのがベストです。

 

● 一括処理は「記事の編集・削除」のページ単位で処理をします。 記事の少ないページでテストをして処理を確認してから、ブログ全体の処理をする事をお勧めします。

 

● このツールは、「styleタグ」の一括記入を行う場合にのみONとし、常駐させて使用するスクリプトではありません。

 

▪「Every Page」をONにすると、幾つかの画面が通常と異なる挙動をする場合があります。 このツールの作業が終了したら、安全のために必ず OFFにしてください。

 

 

常設「styleタグ」の内容 

「Tampermonkey」のコードエディタで、このツールのコードを確認してください。

常設「styleタグ」として、記事の末尾に書き込まれるコード内容は以下です。

(これは、スマホ表示で FontAwesome絵文字の表示を可能にするコードです)

 

「Every Page」ver.1.1 178行~

function edit_target(val,k){
    // 以下の style_textを編集すると、書込まれる styleタグの内容を変更出来ます 🟠🟠🟠
    let style_text=
        '@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css");';
    let insert_elem_s;
    let editor_flg=new_win[k].document.querySelector('input[name="editor_flg"]');

 

太字部分が「styleタグ」に書き込まれます。 このツールをテストして、記事末尾に記入された「styleタグ」を、ブログ編集画面のHTML表示で確認してください。

 

● 上記の太字を任意のコードに書換えて、任意の「styleタグ」を書き込む事が出来ます。 常設「styleタグ」に書き込まれた内容が正しい書式であれば、PC版・スマホアプリ版などの参照環境にかかわらず、ページの表示に反映します。

 

 

処理のスタート 

●「Tampermonkey」のダッシュボードで「Every Page」を「ON」にします。

 

●「記事の編集・削除」の画面をリロードするとツールがスタンバイして、下の様な「スタートスイッチ」(赤枠)が表示されます。 また、リスト画面全体が少しコンパクトになります。

 

● リストのウインドウを、デスクトップの右側寄りに配置します。

 

 

● ボタンを押すと確認のダイアログが出て、「OK」を押すと処理が開始されます。 処理は1分半程度で終了します。(ブラウザのリロードで処理を中止できます)

 

 

下は、処理が開始された状態で、左側に小型化した編集ウインドウが記事ごとに開き、各記事の処理が終わると自動的に閉じます。 右の元画面は、処理の進行に従って、記事の単位で背景色が変化します。

 

 

● 以下は処理経過のサンプルです。 グリーンは処理が「正常終了」、青枠は「読込み処理中」です。 下側はリストの最初の状態で「未処理」の状態です。

 

 

通常は処理が進行して全て「グリーン」に変化します。 文末に既に常設「styleタグ」があった場合は、処理をせず「淡いグリーン」背景になります。 また、「文字数超過」で保存が出来ない場合などエラーがあった場合は「赤枠」を表示します。

 

● 例外で処理が停止した記事は、左側の小ウインドウが残ります。 それらのウインドウを大きく開き、原因を調べる事が出来ます。 削除処理が済んで停止しているだけの場合には、保存を押すだけで解決します。

 

●「処理中」や「未処理」を残してスクリプトが停止する場合は、通信環境が良くない可能性があります。

 

● ページを移動すると、上図の結果表示の配色はリセットされます。

 

● 上記の操作をページを変えて行い、ブログの一部または全体の処理をします。

 

●「Every Page」は、このツールが書込んだ「styleタグ」が既にある場合は、上書きをしません。 もし「styleタグ」の内容を書換えたい場合は、「Every Page Plain」を使って、一旦「styleタグ」を削除してから「Every Page」を使う必要があります。 この処理対象が多数の記事になると、大変な労力が必要なので、「Every Page」を使う場合は、常設「styleタグ」の目標環境を事前にしっかり決めておく事が必要です。 

 

 

 

「Every Page」を利用するには

このツールは Chrome / Edge / Firefox版の拡張機能「Tampermonkey」上で動作します。 以下に、このツールの導入手順を簡単に説明します。

 

❶「Tampermonkey」を導入します

◎ 使用しているブラウザに拡張機能「Tampermonkey」を導入する事が必要です。

既に「Tampermonkey」を導入している場合は、この手順 ❶ は不要です。 

拡張機能の導入については、以下のページに簡単な説明があるので参照ください。

 

 

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

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

 

 

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

 

〔コピー方法〕 右サイドバーの   マークのボタンを1度押してください。

 コード枠内の右クリック ➔ コード全体の選択 ➔ コピー操作 が可能になります。

 

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

 

 

〔 Every Page 〕 ver. 1.1

 

// ==UserScript==
// @name         Every Page
// @namespace  http://tampermonkey.net/
// @version       1.1
// @description  「記事の編集・削除」のリストで「常設 styleタグ」を自動記入する
// @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 style=
        '<style>'+
        '.include-ex-linkBtn, .save-browserPush, .save-hashtag-module, .adcrossBanner { '+
        'display: none !important; } '+
        '#globalHeader, #ucsHeader, #ucsMainLeft h1, .l-ucs-sidemenu-area, #ucsMainRight, '+
        '.actionControl, .list_icon, #footerAd, #globalFooter, .checkboxAllControl, '+
        '.selection-bar { display: none !important; } '+

        '#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 { padding: 4px 5px 0 !important; height: 32px; } '+
        '#entryList li:hover { background-color: #e2eef0; } '+
        '#entryList li .entry-column { padding-left: 16px !important; } '+
        '#entryList .leftCol { justify-content: center; } '+
        '#entryList .leftCol h2 a { text-decoration: none !important; } '+
        '#entryList .leftCol dl { display: none !important; } '+
        '#entryList .leftCol, #entryList .titleCol h2 { width: 353px !important; } '+
        '#entryList .leftCol a:hover { text-decoration: none; } '+
        '#entryList .leftCol a:visited { color: #3970b5; } '+

        '#entryList .txtCol { white-space: nowrap; font-size: 13px; margin-bottom: 2px; '+
        'line-height: 16px; } '+
        '#entryList .rightCol { display: flex; width: 410px !important; padding: 8px 0; '+
        'flex-direction: row; margin-top: -2px; margin-left: 0; } '+
        '#entryList .status-text { width: 64px; margin-bottom: -4px; padding: 2px 4px 0; '+
        'font-weight: normal; color: #000; } '+
        '#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; } '+

        '#entryList .txtCol .date { display: inline-block; padding: 2px 4px 0; font-size: 13px; '+
        'color: #000; } '+
        '#entryList .deleteCol { margin: 0 !important; } '+
        '#entryList .deleteCol .process+.process, #entryList dd+dd { margin-left: 10px; } '+
        '#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); overflow: hidden; } '+
        '#entryList .deleteCol a:hover { outline: auto #1976d2; } '+
        '#entryList .deleteCol .process svg { width: 16px; height: 16px; } '+

        '#sorting{ margin: 0 0 4px; padding: 4px 10px; height: 24px; } '+
        '#sorting ul { padding-top: 3px; } '+
        '#sorting >span { font-size: 15px; line-height: 15px; font-weight: bold; '+
        'display: inline-block; margin-left: 50px; padding: 3px 6px 0; '+
        'border: 1px solid #aaa; border-radius: 4px; background: #fff; cursor: pointer; } '+
        '.pagingArea .active { border: 2px solid #0066cc; }'+
        '</style>';

    document.head.insertAdjacentHTML('beforeend', style);

})



window.addEventListener('load', function(){ // このスクリプトは孫ウインドウだけで働く
    let body_id=document.body.getAttribute("id");
    if(body_id=="entryCreate"){ // この項だけ孫ウインドウで働く

        select_e(close_w);

        function select_e(close_w){
            let error_report=document.querySelector('h1.p-error__head');
            if(error_report==null){
                if(window.opener){
                    report('gray');
                    window.opener.close(); }} // エラー無い場合 grayを送信 親ウインドウを閉じる
            else{
                if(window.opener){
                    report('red');
                    window.opener.location.reload();
                }} // エラー報告のある場合は redを送信 親ウインドウを残す
            close_w(); }

        function close_w(){
            let close_button=document.querySelector('.entryComplete__close');
            close_button.click(); } // 子ウインドウは常に閉じる

        function report(color){
            window.opener.document.querySelector('html').style.color=color; }}})



window.addEventListener('load', function(){ // このスクリプトは親ウインドウで働くメインスクリプト
    var entry_target;
    var publish_f;
    var list_bar;
    var new_win;
    var link_target;
    var result_f;

    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 start_button=
            '<p id="start_ep">Start Processing'+
            '<style>'+
            '#sorting { position: relative; } '+
            '#start_ep { position: absolute; top: 4px; right: 15px; font: bold 14px Meiryo; '+
            'width: auto; padding: 1px 15px 0; border: 1px solid #aaa; border-radius: 4px; '+
            'background: #fff; cursor: pointer; }'+
            '</style></p>';

        let sorting=document.querySelector('#sorting');
        if(sorting){
            sorting.insertAdjacentHTML('beforeend', start_button); }

        let start_ep=document.querySelector('#start_ep');
        if(start_ep){
            start_ep.onclick=function(){ start_select(); };

            function start_select(){
                sorting.removeChild(start_ep);
                if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合
                    alert('編集対象の記事がありません'); }
                if(entry_target.length >0){ // 編集対象がリストに有る場合
                    let ok=confirm('このページの対象記事:' + entry_target.length + '\n ⏬タグ記入を実行しますか?');
                    if(ok){ open_all(); }}}
        }}


    function open_all(){
        entry_target=document.querySelectorAll('.deleteCol');
        publish_f=document.querySelectorAll('input[name="publish_flg"]');
        new_win=Array(entry_target.length);
        link_target=Array(entry_target.length);
        result_f=Array(entry_target.length);

        open_win(0);
        if(entry_target.length>1){
            let k=1;
            let slow_open=setInterval( function(){
                open_win(k);
                k +=1;
                if(k>=entry_target.length){ clearInterval(slow_open); }}, 4000); }} // 4secの間隔で自動実行 ⭕


    function open_win(k){
        result_f[k]=0;
        entry_target=document.querySelectorAll('.deleteCol');
        publish_f=document.querySelectorAll('input[name="publish_flg"]');

        link_target[k]=entry_target[k].getElementsByTagName('a')[0].getAttribute('href');
        let top_p=100 + 30*k;
        new_win[k]=window.open(link_target[k], k, 'top=' + top_p + ', left=100, width=600, height=180');

        result_f[k]=1; // 読込み開始
        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); }, 500); });} // 子ウインドウで書込み開始


    function edit_target(val,k){
        // 以下の style_textを編集すると、書込まれる styleタグの内容を変更出来ます 🟠🟠🟠
        let style_text=
            '@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css");';

        let insert_elem_s;
        let editor_flg=new_win[k].document.querySelector('input[name="editor_flg"]');

        if(editor_flg.value=='5'){ // 最新版エディタの文書の場合
            let editor_iframe=new_win[k].document.querySelector('.cke_wysiwyg_frame');
            let iframe_doc=editor_iframe.contentWindow.document;
            if(iframe_doc){
                let style_tag=iframe_doc.querySelector('style.asa');
                let iframe_body=iframe_doc.querySelector('body.cke_editable');
                insert_elem_s=iframe_doc.createElement('style');
                insert_elem_s.appendChild(iframe_doc.createTextNode(style_text));
                insert_elem_s.setAttribute('class', 'asa'); // class名「asa」

                if(style_tag){
                    new_win[k].close();
                    result_f[k]=2; // 無処理
                    list_bar[k].style.boxShadow='none';
                    list_bar[k].style.backgroundColor='#e5f4f3'; } // タグが有れば子ウインドウを閉じ 背景 淡グリーン
                else{
                    iframe_body.appendChild(insert_elem_s); // styleタグ書込み
                    twice(end_do,k); }}} // 書き込みして送信

        if(editor_flg.value=='1'){ // タグ編集エディタの文書の場合
            let preview=new_win[k].document.getElementById('js-light-preview');
            let tageditor_text=new_win[k].document.getElementById('entryTextArea');
            let style_tag_n=preview.querySelector('style.asa');

            if(style_tag_n){
                result_f[k]=2; // 無処理
                list_bar[k].style.boxShadow='none';
                list_bar[k].style.backgroundColor='#e5f4f3';
                new_win[k].close(); } // タグが有れば子ウインドウを閉じ 背景 淡グリーン
            else{
                tageditor_text.insertAdjacentHTML('beforeend', '<style class="asa">' + style_text + '</style>');
                twice(end_do,k); }} // 書き込みして送信


        function twice(end_do,k){
            setTimeout( function(){
                publish_do(val,k); }, 500);
            end_do(k); }

        function end_do(k){
            result_f[k]=3; // 送信処理
            new_win[k].addEventListener('beforeunload', flag_line , false); }

        function flag_line(){
            let send_color=new_win[k].document.querySelector('html').style.color;
            if(send_color=='gray'){
                result_f[k]=4; // 正常終了の報告
                list_bar[k].style.boxShadow='none';
                list_bar[k].style.backgroundColor='#bae5ea'; } // 孫ウインドウが編集ウインドウを閉じたら 背景グリーン
            if(send_color=='red'){
                result_f[k]=5; // エラー終了の報告
                list_bar[k].style.boxShadow='inset 0 0 0 2px red';
                list_bar[k].style.backgroundColor='#ffffff'; }} // 孫ウインドウのエラー報告の場合は閉じず 背景 白 赤枠

        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){ publish_b0.click(); }}}

})

 

 

〔追記〕2023.10.26

常設「styleタグ」の目的は「FontAwesome」の呼込み指定コードの実行ですが、そのバージョンを「font-awesome/6.1.1」➔「font-awesome/6.4.2」に更新しました。 更新した「Every Page」のバージョンは「ver. 1.2」になります。

 

ただし、「FontAwesome」のバージョン更新は新しく追加された絵文字に対応できる様にするためで、旧バージョンの「styleタグ」の書き込まれた記事にはその当時の絵文字しか使用されないので、あえて過去記事を修正する必要はありません。

 

 

〔 Every Page 〕 ver. 1.2

 

// ==UserScript==
// @name         Every Page
// @namespace  http://tampermonkey.net/
// @version       1.2
// @description  「記事の編集・削除」のリストで「常設 styleタグ」を自動記入する
// @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 style=
        '<style>'+
        '.include-ex-linkBtn, .save-browserPush, .save-hashtag-module, .adcrossBanner { '+
        'display: none !important; } '+
        '#globalHeader, #ucsHeader, #ucsMainLeft h1, .l-ucs-sidemenu-area, #ucsMainRight, '+
        '.actionControl, .list_icon, #footerAd, #globalFooter, .checkboxAllControl, '+
        '.selection-bar { display: none !important; } '+

        '#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 { padding: 4px 5px 0 !important; height: 32px; } '+
        '#entryList li:hover { background-color: #e2eef0; } '+
        '#entryList li .entry-column { padding-left: 16px !important; } '+
        '#entryList .leftCol { justify-content: center; } '+
        '#entryList .leftCol h2 a { text-decoration: none !important; } '+
        '#entryList .leftCol dl { display: none !important; } '+
        '#entryList .leftCol, #entryList .titleCol h2 { width: 353px !important; } '+
        '#entryList .leftCol a:hover { text-decoration: none; } '+
        '#entryList .leftCol a:visited { color: #3970b5; } '+

        '#entryList .txtCol { white-space: nowrap; font-size: 13px; margin-bottom: 2px; '+
        'line-height: 16px; } '+
        '#entryList .rightCol { display: flex; width: 410px !important; padding: 8px 0; '+
        'flex-direction: row; margin-top: -2px; margin-left: 0; } '+
        '#entryList .status-text { width: 64px; margin-bottom: -4px; padding: 2px 4px 0; '+
        'font-weight: normal; color: #000; } '+
        '#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; } '+

        '#entryList .txtCol .date { display: inline-block; padding: 2px 4px 0; font-size: 13px; '+
        'color: #000; } '+
        '#entryList .deleteCol { margin: 0 !important; } '+
        '#entryList .deleteCol .process+.process, #entryList dd+dd { margin-left: 10px; } '+
        '#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); overflow: hidden; } '+
        '#entryList .deleteCol a:hover { outline: auto #1976d2; } '+
        '#entryList .deleteCol .process svg { width: 16px; height: 16px; } '+

        '#sorting{ margin: 0 0 4px; padding: 4px 10px; height: 24px; } '+
        '#sorting ul { padding-top: 3px; } '+
        '#sorting >span { font-size: 15px; line-height: 15px; font-weight: bold; '+
        'display: inline-block; margin-left: 50px; padding: 3px 6px 0; '+
        'border: 1px solid #aaa; border-radius: 4px; background: #fff; cursor: pointer; } '+
        '.pagingArea .active { border: 2px solid #0066cc; }'+
        '</style>';

    document.head.insertAdjacentHTML('beforeend', style);

})



window.addEventListener('load', function(){ // このスクリプトは孫ウインドウだけで働く
    let body_id=document.body.getAttribute("id");
    if(body_id=="entryCreate"){ // この項だけ孫ウインドウで働く

        select_e(close_w);

        function select_e(close_w){
            let error_report=document.querySelector('h1.p-error__head');
            if(error_report==null){
                if(window.opener){
                    report('gray');
                    window.opener.close(); }} // エラー無い場合 grayを送信 親ウインドウを閉じる
            else{
                if(window.opener){
                    report('red');
                    window.opener.location.reload();
                }} // エラー報告のある場合は redを送信 親ウインドウを残す
            close_w(); }

        function close_w(){
            let close_button=document.querySelector('.entryComplete__close');
            close_button.click(); } // 子ウインドウは常に閉じる

        function report(color){
            window.opener.document.querySelector('html').style.color=color; }}})



window.addEventListener('load', function(){ // このスクリプトは親ウインドウで働くメインスクリプト
    var entry_target;
    var publish_f;
    var list_bar;
    var new_win;
    var link_target;
    var result_f;

    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 start_button=
            '<p id="start_ep">Start Processing'+
            '<style>'+
            '#sorting { position: relative; } '+
            '#start_ep { position: absolute; top: 4px; right: 15px; font: bold 14px Meiryo; '+
            'width: auto; padding: 1px 15px 0; border: 1px solid #aaa; border-radius: 4px; '+
            'background: #fff; cursor: pointer; }'+
            '</style></p>';

        let sorting=document.querySelector('#sorting');
        if(sorting){
            sorting.insertAdjacentHTML('beforeend', start_button); }

        let start_ep=document.querySelector('#start_ep');
        if(start_ep){
            start_ep.onclick=function(){ start_select(); };

            function start_select(){
                sorting.removeChild(start_ep);
                if(entry_target.length==0 || entry_target==null){ // 編集対象がリストに無い場合
                    alert('編集対象の記事がありません'); }
                if(entry_target.length >0){ // 編集対象がリストに有る場合
                    let ok=confirm('このページの対象記事:' + entry_target.length + '\n ⏬タグ記入を実行しますか?');
                    if(ok){ open_all(); }}}
        }}


    function open_all(){
        entry_target=document.querySelectorAll('.deleteCol');
        publish_f=document.querySelectorAll('input[name="publish_flg"]');
        new_win=Array(entry_target.length);
        link_target=Array(entry_target.length);
        result_f=Array(entry_target.length);

        open_win(0);
        if(entry_target.length>1){
            let k=1;
            let slow_open=setInterval( function(){
                open_win(k);
                k +=1;
                if(k>=entry_target.length){ clearInterval(slow_open); }}, 4000); }} // 4secの間隔で自動実行 ⭕


    function open_win(k){
        result_f[k]=0;
        entry_target=document.querySelectorAll('.deleteCol');
        publish_f=document.querySelectorAll('input[name="publish_flg"]');

        link_target[k]=entry_target[k].getElementsByTagName('a')[0].getAttribute('href');
        let top_p=100 + 30*k;
        new_win[k]=window.open(link_target[k], k, 'top=' + top_p + ', left=100, width=600, height=180');

        result_f[k]=1; // 読込み開始
        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); }, 500); });} // 子ウインドウで書込み開始


    function edit_target(val,k){
        // 以下の style_textを編集すると、書込まれる styleタグの内容を変更出来ます 🟠🟠🟠
        let style_text=
            '@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css");';

        let insert_elem_s;
        let editor_flg=new_win[k].document.querySelector('input[name="editor_flg"]');

        if(editor_flg.value=='5'){ // 最新版エディタの文書の場合
            let editor_iframe=new_win[k].document.querySelector('.cke_wysiwyg_frame');
            let iframe_doc=editor_iframe.contentWindow.document;
            if(iframe_doc){
                let style_tag=iframe_doc.querySelector('style.asa');
                let iframe_body=iframe_doc.querySelector('body.cke_editable');
                insert_elem_s=iframe_doc.createElement('style');
                insert_elem_s.appendChild(iframe_doc.createTextNode(style_text));
                insert_elem_s.setAttribute('class', 'asa'); // class名「asa」

                if(style_tag){
                    new_win[k].close();
                    result_f[k]=2; // 無処理
                    list_bar[k].style.boxShadow='none';
                    list_bar[k].style.backgroundColor='#e5f4f3'; } // タグが有れば子ウインドウを閉じ 背景 淡グリーン
                else{
                    iframe_body.appendChild(insert_elem_s); // styleタグ書込み
                    twice(end_do,k); }}} // 書き込みして送信

        if(editor_flg.value=='1'){ // タグ編集エディタの文書の場合
            let preview=new_win[k].document.getElementById('js-light-preview');
            let tageditor_text=new_win[k].document.getElementById('entryTextArea');
            let style_tag_n=preview.querySelector('style.asa');

            if(style_tag_n){
                result_f[k]=2; // 無処理
                list_bar[k].style.boxShadow='none';
                list_bar[k].style.backgroundColor='#e5f4f3';
                new_win[k].close(); } // タグが有れば子ウインドウを閉じ 背景 淡グリーン
            else{
                tageditor_text.insertAdjacentHTML('beforeend', '<style class="asa">' + style_text + '</style>');
                twice(end_do,k); }} // 書き込みして送信


        function twice(end_do,k){
            setTimeout( function(){
                publish_do(val,k); }, 500);
            end_do(k); }

        function end_do(k){
            result_f[k]=3; // 送信処理
            new_win[k].addEventListener('beforeunload', flag_line , false); }

        function flag_line(){
            let send_color=new_win[k].document.querySelector('html').style.color;
            if(send_color=='gray'){
                result_f[k]=4; // 正常終了の報告
                list_bar[k].style.boxShadow='none';
                list_bar[k].style.backgroundColor='#bae5ea'; } // 孫ウインドウが編集ウインドウを閉じたら 背景グリーン
            if(send_color=='red'){
                result_f[k]=5; // エラー終了の報告
                list_bar[k].style.boxShadow='inset 0 0 0 2px red';
                list_bar[k].style.backgroundColor='#ffffff'; }} // 孫ウインドウのエラー報告の場合は閉じず 背景 白 赤枠

        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){ publish_b0.click(); }}}

})

 

 

 

「Every Page」最新版について 

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

 

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