「Theme Rep N」の操作マニュアル(更新版)

「Theme Rep N」は、新タイプのブログスキンに対応するブログ記事のテーマ整理ツールです。 このツールを使う事で、大量の記事のテーマ整理が快適に行えます。 操作は判り易く、すぐに慣れて扱える様になると思います。

 

〔動作条件〕

 ▪Windows 10 の動作するPC 

 ▪ブラウザ Chrome・Edge / Firefox

 ▪各ブラウザ版の拡張機能「Tampermonkey」の導入が必要

 

新タイプのブログスキンは、ページャーの縦幅が高く、ページャー上部にグローバルメニュー帯があるのが基本デザインです。

 

 

「Theme Rep N」の導入手順はこのページの最後に纏めています。

(このマニュアルは ver. 1.1 段階の仕様で制作しています)

 

 

 

 テーマ整理を始める前に

◎ このツールは編集サブウインドウを開くため、ブラウザのポップアップブロック設定が有効になっていると動作を妨げられます。 ブラウザのブロック解除の設定方法に従い「https://blog.ameba.jp」「https://ameblo.jp/」を ポップアップ許可URLに追加してください。

 

◎「Theme Rep N」は、ブラウザ拡張機能の「Tampermonkey」に登録して使用します。 ツールの ON・OFFは「Tampermonkey」のダッシュボード(管理画面)で行います。

 

◎「Theme Rep N」は新タイプスキンの「記事一覧」のリストを開いた状態で動作します。 このバージョンは「新着」「月別」「テーマ別」「アメンバー限定」の全てのタブ画面でテーマ整理が出来ます。

 

◎ このツールをONにすると、アメブロ編集画面が通常の編集が出来ないデザインに変更されます。 テーマ整理を行う際は、ブラウザの他の画面を閉じ、ツールをONにして、その操作のみに集中してください。

 

◎「Theme Rep N」をONにすると、ブログ画面の上部に専用の「操作パネル」が表示されます。 テーマ整理の作業が済んだら、忘れず「Theme Rep N」をOFFにして「操作パネル」が消えた事を確認してください。

 

 

「起動」と「テーマ取得」 

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

 

下は「Theme Rep N」をONにして「記事一覧」を開いたところです。

 

 

ウインドウ上部に「操作パネル」と「登録テーマ一覧」のパネルが表示されます。

 

 

「操作パネル」の上段は操作手順の説明です。 また後に、設定したテーマ変更内容がここに表示されます。

 

● 先ず最初に、下段の「テーマ取得」のボタンを押します。 

 ▪自動的に「テーマ別」のタブ画面が一度開きます。

 ▪登録テーマが取得され、右側の「登録テーマ一覧」パネルに表示されます。

   ▪テーマ数が多い場合は「登録テーマ一覧」パネルがスクロール表示になります。

 ▪自動的にボタンを押した元のタブ画面に戻ります。

 

 

◎「操作パネル」の「パネル位置」ボタンを押すごとに、「登録テーマ一覧」パネルの左配置・右配置が入れ替わります。 処理をし易い配置に設定してください。

 

 

 

テーマ変更をする「記事」の選択 

「記事リスト」の記事にマウスポインターを乗せると「青枠」が表示されます。 変更する「記事」は、次の操作を組み合わせて記事を選択します。

 

●「Click」すると選択(青背景)と非選択(元の表示)が切り替わります。

 

●「Ctrl+Click」で「記事リスト」の全記事の選択・非選択が切り替わります。

 

◎ 変更処理はページ上の「記事リスト」の範囲(最大20件)で可能で、リストが複数ページにわたる場合は、各ページ単位で処理をします。

 

◎ 選択した「記事」を纏めて、ひとつの「変更先テーマ」に変更します。

 

◎「新着」「月別」「テーマ別」「アメンバー限定」の全てのタブ画面で、処理が可能です。

 

 

 

「変更先テーマ」を指定 

◎「変更先テーマ」は「登録テーマ一覧」のパネルで指定します。

 

◎ 一覧に無い「新規テーマ」に変更したい時は、「テーマ編集」ボタンでブログ管理の「テーマ編集」画面を開き、「新規テーマ」を作成してから変更操作をします。

 

●「登録テーマ一覧」のパネルで、「変更先テーマ」を「Click」します。

 

 

選択した「変更先テーマ」に赤枠が表示されます。「記事リスト」で選択した記事数と、この変更先の内容が、操作パネル上段に整理して表示されます。

 

◎ この段階で「変更先テーマ」は変更できますが、変更する「記事」の選択は変更ができません。

 

◎「Cancel」ボタンを押すと、変更する「記事」の選択をやりなおせます。

 

◎ 全てをやりなおすには、ブラウザの「 」ボタンでページ全体をリロードします。

 

 

テーマ変更を自動実行 

●「OK」を押すと連続したテーマ変更処理が開始されます。

 

◎ 指定した記事を順に小型のサブウインドウに開いて処理します。 処理が始まると、処理が終るまでPCの通常操作が出来なくなります。

 

◎ サブウインドウはデスクトップ左上隅に開きます。「記事一覧」のメインウインドウは、デスクトップの右に寄せて変更処理を始めると良いでしょう。

 

◎「サブウインドウ」は記事ごとに開いて、数秒間で閉じて入れ替わりますが、「テーマ設定」が書き変えられる様子が判ります。

 

 

◎ 変更処理中は指定した記事数と処理済の記事数を示す「プログレスバー」が、操作パネルの下段に表示されます。

 

 

◎ 指定された変更処理が終了すると、操作パネルに終了の表示が出ます。 処理指定と経過の確認のため、処理終了後 4秒間 以前の状態を表示します。 その後に自動的にページがリロードされ、「登録テーマ一覧」パネルとタブ画面の「記事リスト」が処理後の表示に更新されます。

 

◎「テーマ別」のタブ画面で「テーマ変更」の処理をした場合は、タブ画面上の記事が別テーマに移動するので、「記事リスト」の記事数が変化します。

 

 

 

 サブウインドウの配置について

「サブウインドウ」は処理用に小型化した編集画面で、この配置位置は自由に変更ができます。 モニター幅に余裕がない場合は、「記事一覧」のウインドウ上に「サブウインドウ」を載せた配置でも処理が出来ます。

 

●「変更処理」を始める前に「サブウインドウ位置」ボタンを押します。

 

◎ デスクトップに位置設定用の「サブウインドウの位置設定」が表示されます。 これを仮のサブウインドウと考えて、適当な位置にドラッグします。

 

◎ 配置を決めたら「位置を設定」ボタンを押します。

 

◎ 仮のサブウインドウが消え、以降は「サブウインドウ」がその場所に表示されます。 この設定は自動処理の実行中でなければ、何度でも変更できます。

 

 

 

 

操作上の注意など 

◎「Theme Rep N」は非常駐型ツールで、「テーマ整理」の処理時のみにONとする様に注意してください。 ONにすると、通常の編集操作ができなくなります。

 

◎ 自動処理を開始すると、他のPC操作はほぼ出来なくなります。 どうしても中断したい場合は、「操作パネル」上の「処理中止」ボタンを押します。

 

◎「処理中止」を押した時のサブウインドウの処理が終了してから、処理が停止します。 それ以降に予約されていた記事の処理はキャンセルされます。

 

◎ このツールは「テーマ変更」処理のみを行い、一般に記事の他の部分に影響する事は殆ど考えられません。(但し、特殊な場合の損失は自己責任とお考えください)

 

◎ ツールの変更処理の速度と安定性は、通信環境に影響されます。 良好な通信環境では、20件(1ページの最大件数)を 3分程度で処理します。 少ない件数の指定ではすぐに終了するので、最初は少ない指定で慣れると良いでしょう。

 

◎ 通信環境が悪い場合などに、自動処理中に停止する事があります。 開いている小型の編集画面の「投稿する」ボタンを押すと、多くの場合に処理が再開します。

 

◎「サブウインドウ」の「投稿する」ボタンは自動で2回押されます。 2回目が押されるのは通信状況で処理が遅れた場合です。 2回目はボタンが赤表示になりますが、これは目安で、処理が停止しない限り気にする必要はありません。

 

下は小型の編集画面(サブウインドウ)です。

 

 

「Ameblo Writer」のアレンジが適用されている場合は、下の表示になります。

 

 

◎ 大量の記事の「テーマ変更」を行う場合は、処理時に必要がないブラウザの拡張機能を停止し、ブラウザの負担を減らす事を考慮ください。 また、通信環境の良い深夜等には、最も安定した処理が期待できます。

 

 

 

「Theme Rep N」 ver. 0.9 の導入手順

「Theme Rep N」は Chrome・Edge / Firefox の拡張機能「Tampermonkey」上で動作するスクリプトツールです。

 

以下に簡単な導入手順を示します。

 

❶「Tampermonkey」を導入します

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

 

 

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

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

 

 

 

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

 

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

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

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

 

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

 

 

〔 Theme Rep N 〕 ver. 0.9

 

// ==UserScript==
// @name         Theme Rep N
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  ブログテーマの整理・変更ツール 新スキン版
// @author       Ameba Blog User
// @match        https://ameblo.jp/*
// @match        https://secret.ameba.jp/*
// @match        https://blog.ameba.jp/ucs/entry/srventry*
// @run-at        document-start
// @noframes
// @grant         none
// ==/UserScript==


let theme_list=[]; // 登録テーマの配列
let wake=0; // 起動(遷移起動)の標識

let target0=document.querySelector('head');
let monitor0=new MutationObserver(main0);
monitor0.observe(target0, { childList: true });

function main0(){
    if(document.querySelector('.skin-page')){ // 新スキンブログ画面で動作
        let panel=document.createElement('div');
        panel.innerHTML=
            '<span id="trep_span">テーマ取得 ▷ 記事選択:Click / Ctrl+Click'+
            ' ▷ 変更先テーマ選択:Click</span>'+
            '<div id="trep_inner">'+
            '<span id="trep_progress"></span>'+
            '<input id="theme_write" type="submit" value="OK">'+
            '<input id="not_write" type="submit" value="Cancel">'+
            '<input id="themes_get" type="submit" value="テーマ取得">'+
            '<input id="w_position" type="submit" value="サブウインドウ位置設定">'+
            '<input id="blog_setting" type="submit" value="テーマ編集"></div>'+
            '<style>#trep_panel { position: fixed; z-index: 100; top: 60px; left: 60px; '+
            'font: bold 16px/24px Meiryo; color: #999; background: #fff; '+
            'width: 620px; height: 80px; padding: 17px 5px 0; text-align: left; '+
            'border: 1px solid #aaa; border-radius: 6px; box-sizing: content-box; '+
            'overflow: hidden; box-shadow: 0 20px 30px rgb(0, 0, 0, .2); } '+
            '#trep_span { margin-left: 20px; white-space: nowrap; } '+
            '#trep_inner { position: absolute; bottom: 6px; left: 5px; '+
            'height: 37px; width: 620px; background: #e4eef8; } '+
            '#trep_progress { margin-left: 20px; line-height: 41px; opacity: .5; } '+
            '.trep_box { padding: 3px 15px 0; margin: 0 10px; color: #000; '+
            'border: 1px solid #666; border-radius: 2px; } '+
            '.trep_num { font-size: 12px; color: #777; } '+
            '#theme_write, #not_write, #themes_get, #w_position, #blog_setting { '+
            'position: absolute; bottom: 4px; font: bold 16px Meiryo; padding: 2px 10px 0; '+
            'height: 29px; color: #000; box-shadow: inset 0 0 0 40px rgb(40, 180, 250, 0.3); } '+
            '#theme_write { right: 280px; display: none; } '+
            '#not_write { right: 180px; display: none; } '+
            '#themes_get, #w_position, #blog_setting { display: block; color: #777; '+
            'box-shadow: inset 0 0 0 20px rgb(0, 255, 232, 0.1); } '+
            '#themes_get { left: 20px; } #w_position { left: 180px; } '+
            '#blog_setting { right: 25px; }</style>';

        panel.setAttribute('id', 'trep_panel');
        let trep_panel=document.querySelector('#trep_panel');
        if(!trep_panel){
            document.querySelector('body').appendChild(panel); }


        let blog_setting=document.querySelector('#blog_setting');
        if(blog_setting){
            blog_setting.onclick=function(){
                window.open('https://blog.ameba.jp/ucs/theme/themeinput.do', '_blank'); }}


        let themes_get=document.querySelector('#themes_get');
        if(themes_get){
            themes_get.onclick=function(){
                let entryThemes=document.querySelector('.skin-entryThemes a');
                if(entryThemes){ // 記事一覧外でテーマ取得がクリックされた場合
                    entryThemes.click(); }
                else{
                    let theme_tab=document.querySelector('.skin-archiveNavTabs li:nth-child(3)>a');
                    if(theme_tab){
                        wake=1; // 記事一覧内でテーマ取得がクリックされた場合
                        theme_tab.click(); }}}}

    } // 新スキンブログ画面で動作
} // main0()



let target1=document.querySelector('head');
let monitor1=new MutationObserver(main1);
monitor1.observe(target1, { childList: true });

function main1(){
    let bord_active=document.querySelector('.skin-borderLoud.is-active');
    if(bord_active){ // 記事一覧画面で動作

        let style=document.createElement('style');
        style.innerHTML=
            '#main { font-family: Meiryo; } '+
            '.skin-archiveList .skin-borderQuiet:hover { '+
            'outline: 1px solid #2196f3; outline-offset: -1px; '+
            'box-shadow: inset 0 0 0 120px rgba(187, 222, 251, .3); } '+
            '.skin-archiveList .skin-borderQuiet:hover * { opacity: 1; } '+
            '.select_item { background: #2196f3; } '+
            '.select_item * { color: #fff; } '+
            '.doing_item { background: #00bcd4; } '+
            '.doing_item .skin-textQuiet { color: #fff; } '+
            '[data-uranus-component="archiveList"]>li { padding: 4px 8px; } '+
            '[data-uranus-component="entryItemImage"], '+
            '[data-uranus-component="imageFrame"] img '+
            '{ height: 88px !important; width: 88px !important; overflow: hidden; } '+
            '[data-uranus-component="entryItemTitle"] { margin-bottom: 0; } '+
            '[data-uranus-component="entryItemMeta"] { min-height: 40px; } '+
            '[data-uranus-component="entryItemMeta"]> * { margin-bottom: -2px; }';
        style.setAttribute("id", 'trep_style');
        if(!document.getElementById('trep_style')){
            document.querySelector('body').appendChild(style); }

        learn_themes();

        let s_mode=0; // 選択操作モード
        let count; // 変更指定した文書数
        let selected_array;
        let new_win;
        let link_target;
        let trep_wtop;
        let trep_wleft;

        select_set();
        select_to();

        function select_set(){
            let ac_list=document.querySelectorAll('.skin-archiveList .skin-borderQuiet');
            for(let k=0; k<ac_list.length; k++){
                ac_list[k].onclick=function(event){
                    event.preventDefault();
                    if(event.ctrlKey){
                        select_all(ac_list[k]); }
                    else{
                        selected(ac_list[k]); }}}

            function select_all(item){
                if(s_mode==0){
                    if(item.classList.contains('select_item')){
                        for(let k=0; k<ac_list.length; k++){
                            ac_list[k].classList.remove('select_item'); }}
                    else{
                        for(let k=0; k<ac_list.length; k++){
                            ac_list[k].classList.add('select_item'); }}}}

            function selected(item){
                if(s_mode==0){
                    if(item.classList.contains('select_item')){
                        item.classList.remove('select_item'); }
                    else{
                        item.classList.add('select_item'); }}}
        } // select_set()


        function learn_themes(){
            let panel2=document.createElement('div');
            panel2.innerHTML=
                '<p>   登録テーマ一覧</p><ul id="themes_ul"></ul>'+
                '<style>#themes_panel { position: fixed; z-index: 100; top: 60px; '+
                'left: 720px; font: bold 16px/24px Meiryo; color: #666; background: #fff; '+
                'min-width: 200px; min-height: 77px; padding: 8px 6px 12px; '+
                'border: 1px solid #aaa; border-radius: 6px; box-sizing: content-box; '+
                'text-align: left; box-shadow: 0 20px 30px rgb(0, 0, 0, .2); } '+
                '#themes_panel p { margin-bottom: 12px; padding: 4px 0 2px; '+
                'background: #e4eef8; } '+
                '.themes_li { padding: 3px 12px 0; margin-bottom: 5px; cursor: pointer; '+
                'outline: 1px solid #ccc; outline-offset: -1px; } '+
                '.themes_li:hover { background: #eee; } '+
                '.themes_li.to_theme { outline: 2px solid red; }</style>';

            panel2.setAttribute('id', 'themes_panel');
            if(!document.querySelector('#themes_panel')){
                document.querySelector('body').appendChild(panel2); }

            setTimeout(()=>{
                let bord_active=document.querySelector('.skin-borderLoud.is-active');
                if(bord_active && bord_active.textContent=="テーマ別"){ // テーマ別画面で動作

                    let btn_arch=document.querySelectorAll('.skin-btnArchive');
                    for(let i=0; i<btn_arch.length; i++){
                        theme_list[i]=[ , ]; }

                    for(let k=0; k<btn_arch.length; k++){
                        let btn_link=btn_arch[k].getAttribute('href').split('theme-');
                        let theme_id=btn_link[1].slice(0, 11);
                        let theme_name=btn_arch[k].textContent;
                        theme_list[k][0]=theme_id;
                        theme_list[k][1]=theme_name; }

                    let themes_panel=document.querySelector('#themes_panel');
                    let themes_ul=document.querySelector('#themes_ul');

                    for(let k=0; k<theme_list.length; k++){
                        let themes_li=document.createElement('li');
                        themes_li.setAttribute('class', 'themes_li');
                        themes_li.textContent=theme_list[k][1];
                        let themes_lis=document.querySelectorAll('.themes_li');
                        if(themes_lis.length<theme_list.length){
                            themes_ul.appendChild(themes_li); }}

                    if(wake==1){ // 記事一覧内でテーマ取得した場合に 元のタブに戻す
                        wake=0;
                        setTimeout(()=>{
                            history.back();
                        }, 100); }
                }}, 500);
        } // learn_themes()


        function select_to(){
            let themes_li=document.querySelectorAll('.themes_li');
            for(let k=0; k<themes_li.length; k++){
                themes_li[k].onclick=function(event){
                    clear_red();
                    to_theme(k); }}


            function to_theme(select){
                count_select();
                if(count>0){
                    s_mode=1;
                    themes_li[select].classList.add('to_theme'); // 変更先テーマを選択

                    setTimeout(()=>{
                        let trep_span=document.querySelector('#trep_span');
                        let themes_get=document.querySelector('#themes_get');
                        let w_position=document.querySelector('#w_position');
                        let theme_write=document.querySelector('#theme_write');
                        let not_write=document.querySelector('#not_write');
                        if(trep_span &&
                           themes_get && w_position && theme_write && not_write){
                            trep_span.innerHTML=
                                '記事数<span class="trep_box b1"></span>'+
                                '⇨ テーマ<span class="trep_box b2"></span>に変更';
                            document.querySelector('.trep_box.b1').textContent=count;
                            theme_name_disp(theme_list[select][1]);
                            themes_get.style.display='none';
                            w_position.style.display='none';
                            theme_write.style.display='block';
                            not_write.style.display='block';

                            theme_write.onclick=function(){ // OKを押した場合
                                theme_write.style.display='none';
                                not_write.style.display='none';
                                select_array(theme_list[select][0]);
                                open_all(); }

                            not_write.onclick=function(){ // Cancelを押した場合
                                clear_red(); }}
                    }, 100 ); }
            } // to_theme()


            function count_select(){
                count=0;
                let ac_list=document.querySelectorAll('.skin-archiveList .skin-borderQuiet');
                for(let k=0; k<ac_list.length; k++){
                    if(ac_list[k].classList.contains('select_item')){
                        count +=1; }}}
        } // select_to()


        function theme_name_disp(str){
            let name=str.slice(0, str.lastIndexOf('('));
            let num=str.slice(str.lastIndexOf('(')).replace(/[^0-9]/g, '');
            let target_theme=document.querySelector('.trep_box.b2');
            let target_num=document.querySelector('.trep_num');
            if(target_theme){
                target_theme.innerHTML=
                    name+'<span class="trep_num"> ◂'+num+'▸</span>'; }}


        function clear_red(){
            s_mode=0;
            let trep_span=document.querySelector('#trep_span');
            let themes_get=document.querySelector('#themes_get');
            let w_position=document.querySelector('#w_position');
            let theme_write=document.querySelector('#theme_write');
            let not_write=document.querySelector('#not_write');
            trep_span.innerHTML='テーマ取得 ▷ 記事選択:Click / Ctrl+Click ▷ 変更先テーマ選択:Click';
            themes_get.style.display='block';
            w_position.style.display='block';
            theme_write.style.display='none';
            not_write.style.display='none';

            let themes_li=document.querySelectorAll('.themes_li');
            for(let k=0; k<themes_li.length; k++){
                themes_li[k].classList.remove('to_theme');
                themes_li[k].blur(); }}


        function select_array(new_theme){
            selected_array=[];
            link_target=[];
            let ac_list=document.querySelectorAll('.skin-archiveList .skin-borderQuiet');
            for(let k=0; k<ac_list.length; k++){
                if(ac_list[k].classList.contains('select_item')){
                    selected_array.push(ac_list[k]);
                    let title_link=ac_list[k].querySelector('h2 a');
                    let entry_id_a=title_link.getAttribute('href').split('entry-');
                    if(entry_id_a[1]){
                        let entry_id=entry_id_a[1].slice(0, 11);
                        if(entry_id){
                            link_target.push(
                                'https://blog.ameba.jp/ucs/entry/srventryupdateinput.do?id='+entry_id+
                                '&trep='+new_theme); }}}}}


        function open_all(){
            trep_wtop=get_cookie('trep_wtop');
            trep_wleft=get_cookie('trep_wleft');
            progress(0);
            let next=0;
            open_win(next);
            let search=setInterval(continuas, 500); // 自動で実行指示 🟥
            function continuas(){
                if(new_win[next].closed){
                    next +=1;
                    progress(next);
                    if(next<link_target.length){
                        open_win(next); }
                    else{
                        progress(next);
                        clearInterval(search);
                        ending(); }}}}


        function progress(n){
            let disp='';
            let trep_progress=document.querySelector('#trep_progress');
            if(n>=0){
                for(let k=0; k<count; k++){
                    if(k<n){
                        disp +='🟦'; }
                    else{
                        disp +='⬜'; }}
                trep_progress.textContent=disp; }
            else{
                trep_progress.textContent=''; }}


        function open_win(n){
            new_win=[];
            let win_option='top='+trep_wtop+',left='+trep_wleft+
                ',width=620,height=260'; // 🔲

            new_win[n]=window.open(link_target[n], n, win_option); // 🔲
            selected_array[n].classList.remove('select_item');
            selected_array[n].classList.add('doing_item'); } // 処理中のグリーン表示


        function ending(){
            let trep_span=document.querySelector('#trep_span');
            if(trep_span){
                trep_span.innerHTML='処理が終了しました。 テーマ別記事リストを更新します';
                setTimeout(()=>{
                    // reload_part(); // 旧タイプスキンの場合
                    window.location.reload(false); // 新タイプスキンの場合
                }, 4000);
                setTimeout(function(){
                    clear_red();
                    progress(-1);
                    /*
                    let theme_tab=document.querySelector('.skin-archiveNavTabs li:nth-child(3)>a');
                    if(theme_tab){
                        wake=1; // 記事一覧内でテーマ取得がクリックされた場合
                        theme_tab.click(); }
*/
                    select_set();
                    select_to();
                }, 4500); }}


        function reload_part(){
            let part=document.querySelector('.skin-blogArchiveBody.skin-bgMain');
            if(part){
                let url=location.href;
                ajaxUpdate(url, part); // リスト表示を更新

                function ajaxUpdate(url, elem){ // XMLHttpRequestを使ってAjaxで更新
                    url=url+'?ver='+new Date().getTime(); // キャッシュされないurl
                    let ajax=new XMLHttpRequest;
                    ajax.open('GET', url, true);
                    ajax.onload=function(){
                        let tmp=document.createElement('div');
                        tmp.setAttribute('id', 'tmp_div');
                        tmp.style.display='none';
                        let tmp_div=document.querySelector('#tmp_div');
                        if(!tmp_div){
                            document.querySelector('body').appendChild(tmp); }
                        tmp.innerHTML=ajax.responseText;
                        elem.innerHTML=
                            tmp.querySelector('.skin-blogArchiveBody.skin-bgMain').innerHTML;
                        tmp.innerHTML=''; }
                    ajax.send(null); }}}


        let w_position=document.querySelector('#w_position');
        if(w_position){
            w_position.onclick=function(event){
                event.preventDefault();
                let tmp_w;
                open_tmp();

                function open_tmp(){
                    if(!tmp_w || tmp_w.closed){
                        let win_option='top='+get_cookie('trep_wtop')+',left='+get_cookie('trep_wleft')+
                            ',width=620,height=260'; // 🔲
                        tmp_w=window.open('', 'tmp_window', win_option); // 🔲
                        if(!tmp_w.document.querySelector('#tmp_w_set')){
                            tmp_w.document.write(
                                '<p id="tmp_w_set" style="font: bold 18px Meiryo; padding: 30px 0 10px;">'+
                                'サブウインドウの位置設定</p>'+
                                '<p>このサブウインドウを適当な位置へドラッグします<br>'+
                                '下のボタンを押すとウインドウ位置が設定されます</p>'+
                                '<button style="font: bold 16px Meiryo; padding: 2px 10px 0;" '+
                                'onclick="window.close()" type="button">位置を設定</button>'+
                                '<style>body { background: #cbdce3; font-size: 16px; text-align: center; }'+
                                '</style>'); }}}

                tmp_w.onbeforeunload=function(){ // Cookie保存 30日
                    trep_wtop=tmp_w.screenY;
                    trep_wleft=tmp_w.screenX;
                    document.cookie='trep_wtop='+trep_wtop+'; Max-Age=2592000';
                    document.cookie='trep_wleft='+trep_wleft+'; Max-Age=2592000'; }}}


        function get_cookie(name){
            let cookie_req=document.cookie.split('; ').find(row=>row.startsWith(name));
            if(cookie_req){
                if(cookie_req.split('=')[1]==null){
                    return 0; }
                else{
                    return cookie_req.split('=')[1]; }}
            if(!cookie_req){
                return 0; }}

    }} // main1() 記事一覧画面で動作



window.addEventListener('DOMContentLoaded', function(){
    if(location.pathname.indexOf('updateinput')!=-1){ // 編集画面で動作
        let theme_id;
        let query=window.location.search.slice(1); // 文頭?を除外
        if(query){
            let theme_id_n=query.split('&')[1].split('=')[0];
            if(theme_id_n && theme_id_n=='trep'){
                theme_id=query.split('&')[1].split('=')[1]; }}

        if(document.body.classList.contains('l-body')){ // 最新版エディタで動作
            let style=document.createElement('style');
            style.innerHTML=
                '#globalHeader, #js-header-bar, #js-preview, .l-main, .l-hashtag, '+
                '.p-cover, .l-communication, .p-warning--copylight, #globalFooter, '+
                '.p-theme__add { visibility: hidden; position: fixed; } '+
                '.l-form { padding: 16px 0 !important; } .l-body { padding: 0 15px; } '+
                'html { overflow: hidden !important; } '+
                '.p-title__text { min-width: 590px; width: 590px !important; } '+
                '.l-under-module { margin: 0px; } '+
                '.l-postTime { position: absolute; left: 0 !important; } '+
                '.p-theme { position: absolute; left: 250px !important; } '+
                '.p-theme__select { width: 340px; } '+
                '.l-footer { padding: 0; } '+
                '.p-submit__container { margin: 85px 280px 0 0 !important; }';

            style.setAttribute("id", 'trep_style');
            if(!document.getElementById('trep_style')){
                document.querySelector('body').appendChild(style); }

            if(theme_id){ // 編集画面の処理 🟦
                let interval=setInterval(find_selector, 40); // 処理タイミング 🟥
                function find_selector(){

                    let editor_iframe=document.querySelector('.cke_wysiwyg_frame');
                    let iframe_body;
                    if(editor_iframe){
                        let iframe_doc=editor_iframe.contentWindow.document;
                        if(iframe_doc){
                            iframe_body=iframe_doc.querySelector('body.cke_editable'); }}
                    let tageditor_text=document.querySelector('#entryTextArea');
                    let selector=document.querySelector('#js-themeSelector');
                    let publish=document.querySelector('.js-submitButton[publishflg="0"]');

                    if((iframe_body || tageditor_text) && selector && publish){
                        clearInterval(interval);
                        selector.value=theme_id;
                        rel();
                        function rel(){
                            setTimeout(()=>{
                                publish.click();
                            }, 1000); // 処理タイミング 🟥
                            setTimeout(()=>{
                                publish.style.background='red';
                                publish.click();
                            }, 5000); } // バックアップ押下 停止を救済する🟥
                    }}}
        } // 最新版エディタで動作

        else{ // タグ編集エディタで動作
            let style=document.createElement('style');
            style.innerHTML=
                '#globalHeader, #ucsHeader, .l-ucs-sidemenu-area, #ucsMainRight, '+
                '#entryCreate h1, #entryTheme .btnDefault, .entryHashtag, '+
                '#firstDescriptionArea, #entryMain, #displayTag, #atclInfo, #previewBtn, '+
                '.amemberHelp, #attentionBox2 { display: none !important; } '+
                '#ucsContent { background: orange; } '+
                '#ucsMainLeft { margin: 0 20px; } '+
                '#subContentsArea { margin: 0 !important; } '+
                '#title { padding: 2px 10px 0; font: 16px Meiryo; } '+
                '#js-ga_change select { padding: 3px 6px 0; font: 16px Meiryo; } '+
                '.btnDefault { font: 16px Meiryo; } ';

            style.setAttribute("id", 'trep_style');
            if(!document.getElementById('trep_style')){
                document.querySelector('body').appendChild(style); }

            if(theme_id){ // 編集画面の処理 🟦
                let interval=setInterval(find_selector, 200); // 処理タイミング 🟥
                function find_selector(){
                    let selector=document.querySelector('#js-ga_change select');
                    let publish=
                        document.querySelector('.actionControl .btnDefault[value="全員に公開"]');
                    if(selector && publish){
                        clearInterval(interval);
                        selector.value=theme_id;
                        rel();
                        function rel(){
                            setTimeout(()=>{
                                publish.click();
                            }, 1500); // 処理タイミング 🟥
                            setTimeout(()=>{
                                publish.style.background='red';
                                publish.click();
                            }, 5000); } // バックアップ押下 停止を救済する🟥
                    }}}
        } // タグ編集エディタで動作
    }}); // 編集画面で動作



window.addEventListener('DOMContentLoaded', function(){
    if(location.pathname.indexOf('updateend')!=-1){ // 送信完了画面で動作

        window.document.body.style.background='#c5d8e1';
        window.document.body.style.boxShadow='0 0 0 100vh #c5d8e1';

        select_e(close_w);

        function select_e(close_w){
            let error_report=document.querySelector('.p-error');
            if(error_report==null){ // 保存エラー無い場合 編集画面を閉じる
                if(window.opener){
                    window.opener.close(); }}
            else{ // 保存エラーのある場合は 赤を送信 編集画面を残す
                if(window.opener){
                    report('red'); }}
            close_w(); }

        function close_w(){
            window.open('about:blank','_self').close(); } // 完了画面は常に自動的に閉じる

        function report(color){
            window.opener.document.querySelector('.p-title__text').style.background=color; }}

}); // 送信完了画面で動作



 

 

 

「Theme Rep N」最新版について 

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

 

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