Instagram - 為用戶添加備註(別名/標籤)

為用戶添加備註(別名/標籤)功能,以幫助識別和搜尋

目前為 2022-06-14 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                Instagram为关注用户添加备注
// @name:en             Instagram - Add notes(aliases/tags) to the user
// @name:zh-CN          Instagram - 为用户添加备注(别名/标签)
// @name:zh-TW          Instagram - 為用戶添加備註(別名/標籤)
// @name:ja             Instagram - ユーザーへのメモの追加(エイリアス/ラベル)
// @name:ko             Instagram - 사용자에게 메모 추가 (별칭/라벨)
// @name:fr             Instagram - ajouter des notes aux utilisateurs (alias/tag)
// @namespace           https://greasyfork.org/zh-CN/users/193133-pana
// @homepage            https://greasyfork.org/zh-CN/users/193133-pana
// @icon                data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9Im5ld0ljb25UaXRsZSIgc3Ryb2tlPSJyZ2JhKDI5LDE2MSwyNDIsMS4wMCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYmEoMjksMTYxLDI0MiwxLjAwKSI+IDx0aXRsZSBpZD0ibmV3SWNvblRpdGxlIj5OZXc8L3RpdGxlPiA8cGF0aCBkPSJNMTkgMTRWMjJIMi45OTk5N1Y0SDEzIi8+IDxwYXRoIGQ9Ik0xNy40NjA4IDQuMDM5MjFDMTguMjQxOCAzLjI1ODE3IDE5LjUwODIgMy4yNTgxNiAyMC4yODkyIDQuMDM5MjFMMjAuOTYwOCA0LjcxMDc5QzIxLjc0MTggNS40OTE4NCAyMS43NDE4IDYuNzU4MTcgMjAuOTYwOCA3LjUzOTIxTDExLjU4NTggMTYuOTE0MkMxMS4yMTA3IDE3LjI4OTMgMTAuNzAyIDE3LjUgMTAuMTcxNiAxNy41TDcuNSAxNy41TDcuNSAxNC44Mjg0QzcuNSAxNC4yOTggNy43MTA3MSAxMy43ODkzIDguMDg1NzkgMTMuNDE0MkwxNy40NjA4IDQuMDM5MjFaIi8+IDxwYXRoIGQ9Ik0xNi4yNSA1LjI1TDE5Ljc1IDguNzUiLz4gPC9zdmc+
// @version             5.3.12
// @description         为用户添加备注(别名/标签)功能,以帮助识别和搜索
// @description:en      Add a note(alias/tag) for users to help identify and search
// @description:zh-CN   为用户添加备注(别名/标签)功能,以帮助识别和搜索
// @description:zh-TW   為用戶添加備註(別名/標籤)功能,以幫助識別和搜尋
// @description:ja      ユーザーが識別と検索に役立つメモ(エイリアス/タグ)機能を追加する
// @description:ko      사용자 식별 및 검색에 도움이되는 메모 (별칭/태그) 기능 추가
// @description:fr      Ajouter une fonction de notes (alias/tag) pour les utilisateurs pour aider à identifier et rechercher
// @license             GNU General Public License v3.0 or later
// @compatible          chrome
// @compatible          firefox
// @author              pana
// @include             http*://*instagram.com/*
// @require             https://gcore.jsdelivr.net/npm/[email protected]/minified/arrive.min.js
// @require             https://gcore.jsdelivr.net/npm/[email protected]/dist/vue.min.js
// @require             https://gcore.jsdelivr.net/gh/LightAPIs/greasy-fork-library@c5961e56c4461790de3a52f1502e6c007ff64b4a/Note_Obj.js
// @grant               GM_info
// @grant               GM.info
// @grant               GM_getValue
// @grant               GM.getValue
// @grant               GM_setValue
// @grant               GM.setValue
// @grant               GM_deleteValue
// @grant               GM.deleteValue
// @grant               GM_listValues
// @grant               GM.listValues
// @grant               GM_openInTab
// @grant               GM.openInTab
// @grant               GM_registerMenuCommand
// @grant               GM_unregisterMenuCommand
// @grant               GM_addValueChangeListener
// @grant               GM_removeValueChangeListener
// ==/UserScript==

(async function () {
  'use strict';

  /* global Note_Obj */

  // ver.5.2.1 检测对象是否存在
  if (typeof Note_Obj !== 'function') {
    alert('Note_Obj.js was not loaded successfully!');
  }

  const updated = '2022-06-14';

  /**
   * 常用按钮
   * - ver.4.1.1 +
   */
  const INS_ICON = {
    /** 黑色的备注按钮 */
    NOTE_BLACK:
      'url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9Im5ld0ljb25UaXRsZSIgc3Ryb2tlPSJyZ2IoMzgsIDM4LCAzOCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYigzOCwgMzgsIDM4KSI+IDx0aXRsZSBpZD0ibmV3SWNvblRpdGxlIj5OZXc8L3RpdGxlPiA8cGF0aCBkPSJNMTkgMTRWMjJIMi45OTk5N1Y0SDEzIi8+IDxwYXRoIGQ9Ik0xNy40NjA4IDQuMDM5MjFDMTguMjQxOCAzLjI1ODE3IDE5LjUwODIgMy4yNTgxNiAyMC4yODkyIDQuMDM5MjFMMjAuOTYwOCA0LjcxMDc5QzIxLjc0MTggNS40OTE4NCAyMS43NDE4IDYuNzU4MTcgMjAuOTYwOCA3LjUzOTIxTDExLjU4NTggMTYuOTE0MkMxMS4yMTA3IDE3LjI4OTMgMTAuNzAyIDE3LjUgMTAuMTcxNiAxNy41TDcuNSAxNy41TDcuNSAxNC44Mjg0QzcuNSAxNC4yOTggNy43MTA3MSAxMy43ODkzIDguMDg1NzkgMTMuNDE0MkwxNy40NjA4IDQuMDM5MjFaIi8+IDxwYXRoIGQ9Ik0xNi4yNSA1LjI1TDE5Ljc1IDguNzUiLz4gPC9zdmc+)',
    /** 蓝色的搜索按钮 */
    SERACH_BLUE:
      'url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9InNlYXJjaEljb25UaXRsZSIgc3Ryb2tlPSJyZ2JhKDI5LDE2MSwyNDIsMS4wMCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYmEoMjksMTYxLDI0MiwxLjAwKSI+IDx0aXRsZSBpZD0ic2VhcmNoSWNvblRpdGxlIj5TZWFyY2g8L3RpdGxlPiA8cGF0aCBkPSJNMTQuNDEyMTEyMiwxNC40MTIxMTIyIEwyMCwyMCIvPiA8Y2lyY2xlIGN4PSIxMCIgY3k9IjEwIiByPSI2Ii8+IDwvc3ZnPg==)',
  };

  /**
   * @type {String} 基础样式
   * - ver.4.0.0 +
   */
  const INS_STYLE = `
        .note-obj-ins-font-blue-color {
            color: #336699;
        }
        .note-obj-ins-background-box {
            display: inline-block;
            align-items: center;
            white-space: nowrap;
            border-radius: 50px;
            padding: 0px 10px;
            background-color: #336699;
            color: #fff;
        }
        .note-obj-ins-add-btn {
            background-image: ${INS_ICON.NOTE_BLACK};
            background-size: 24px;
            background-repeat: no-repeat;
            background-position: center;
            margin-left: 5px;
            cursor: pointer;
            width: 24px;
            height: 24px;
        }
        .note-obj-ins-homepage-btn {
            margin: 6px !important;
        }
        .note-obj-ins-homepage-btn:hover {
          opacity: 0.5;
        }
        .note-obj-ins-userpage-btn {
            margin-top: 2px;
        }
        .note-obj-ins-userpage-tag {
            display: block;
            font-size: 20px;
            margin-bottom: 20px;
            white-space: nowrap;
        }
        .note-obj-ins-mobile-search-button {
            background-image: ${INS_ICON.SERACH_BLUE};
            background-size: 24px;
            background-repeat: no-repeat;
            background-position: center;
            cursor: pointer;
            min-width: 0px;
            height: 100%;
            flex: 1 1 auto;
        }
        .note-obj-ins-font-bold {
            font-weight: bold;
        }
        .note-obj-veryins-blue-tag {
            background-color: #3c81df;
            color: #fff;
            display: inline-flex;
            align-items: center;
            padding: 0px 10px;
            white-space: nowrap;
            line-height: 100%;
            border-radius: 50px;
            padding: 2px 10px;
        }
        .note-obj-veryins-userpage-btn {
            display: inline-block;
            vertical-align: middle;
        }
        .note-obj-ins-left-box {
          height: 25%;
        }
    `;

  /**
   * 路径选择器
   * - ver.2.1.0 +
   */
  const selector = {
    body: 'body',
    homepage: {
      article: '[role="main"] article',
      id: '._aaqt a',
      icon: 'span._aamz',
      comment_id: '._aap6._aap7._aap8 a',
      comment_at: '._aat6 ._aade > .notranslate',
    },
    homepage_stories: {
      id: '._aamb._aamc',
      id_shell: '._aam8',
    },
    homepage_recommend: {
      id: '._aak3 ._aap6._aap7._aap8 a',
    },
    user_page: {
      frame: '._aa_h',
      id: '._aa_m h2',
      bar: '._aa_n',
      box: '._aa_m',
      common: 'span._aaai',
      suggest: '._acj1 a.notranslate',
      info_at: '.notranslate',
      user_name: '._aa_c > span',
    },
    watch_list: {
      initial_item: '._aae- li',
      later_item: '._aaei',
      id: '._aap6._aap7._aap8 a',
    },
    stories: {
      id: 'a.notranslate',
      id_shell: '._ac0q',
    },
    dialog: {
      frame: '[role="dialog"] ._a3gq article',
      comment_id: '._a9zm ._aap6._aap7._aap8 a',
      comment_at: '._a9zs .notranslate',
    },
    request: {
      follow: '._aajc ._aap6._aap7._aap8 a',
    },
    mobile: {
      bottom_bar: '._abp7',
    },
    suggest: {
      user: '._aa0- ._aap6._aap7._aap8 a',
    },
  };

  /**
   * Instagram - 备注值变动处理事件
   * @param {Note_Obj} note_obj 备注对象实例
   * @param {String} [user_id] 当前处理的用户 id (为了减少仅变更单一用户时的开销)
   */
  function instagram_Change_Event(note_obj, user_id = null) {
    // *处理主页左侧的图片窗口*
    for (const article of document.querySelectorAll(selector.homepage.article)) {
      const article_user = article.querySelector(selector.homepage.id);
      if (article_user) {
        /** 用户主 id */
        const article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);

        (!user_id || user_id == article_user_id) &&
          note_obj.handler(article_user_id, article_user, null, {
            add: note_obj.getConfig().other.replaceHomepageID ? null : 'span',
            classname: note_obj.getConfig().other.replaceHomepageID ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
            title: note_obj.getConfig().other.replaceHomepageID,
          });
      }

      // 处理评论区用户
      for (const comment of article.querySelectorAll(selector.homepage.comment_id)) {
        /** 评论者 id */
        const comment_id = Note_Obj.fn.getUserIdFromLink(comment.href);

        (!user_id || user_id == comment_id) &&
          note_obj.handler(comment_id, comment, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理评论里的 @ 用户
      for (const comment_at of article.querySelectorAll(selector.homepage.comment_at)) {
        const comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);

        (!user_id || user_id == comment_at_id) &&
          note_obj.handler(comment_at_id, comment_at, null, {
            symbol: {
              prefix: '@',
            },
            title: true,
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理单图片页面评论里的用户
      for (const pic_comment_user of article.querySelectorAll(selector.dialog.comment_id)) {
        const pic_comment_id = Note_Obj.fn.getUserIdFromLink(pic_comment_user.href);

        (!user_id || user_id == pic_comment_id) &&
          note_obj.handler(pic_comment_id, pic_comment_user, null, {
            title: true,
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理单图片页面评论里 @ 的用户
      for (const pic_comment_at of article.querySelectorAll(selector.dialog.comment_at)) {
        if (!pic_comment_at.classList.contains(selector.homepage.comment_id.replace(/^\.|\s+.*$/g, ''))) {
          const pic_comment_at_id = Note_Obj.fn.getUserIdFromLink(pic_comment_at.href);

          (!user_id || user_id == pic_comment_at_id) &&
            note_obj.handler(pic_comment_at_id, pic_comment_at, null, {
              symbol: {
                prefix: '@',
              },
              title: true,
              classname: 'note-obj-ins-font-blue-color',
            });
        }
      }
    }

    // *处理主页顶部的快拍窗口*
    for (const homepage_stories of document.querySelectorAll(selector.homepage_stories.id_shell)) {
      if (homepage_stories.querySelector(selector.homepage_stories.id)) {
        const homepage_stories_id = homepage_stories.querySelector(selector.homepage_stories.id).textContent;

        if (!user_id || user_id == homepage_stories_id) {
          homepage_stories.title = note_obj.getUserTag(homepage_stories_id);
        }
      }
    }

    // *处理主页右侧的推荐关注*
    for (const homepage_recommend of document.querySelectorAll(selector.homepage_recommend.id)) {
      const homepage_recommend_id = Note_Obj.fn.getUserIdFromLink(homepage_recommend.href);

      (!user_id || user_id == homepage_recommend_id) &&
        note_obj.handler(homepage_recommend_id, homepage_recommend, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    }

    // *处理用户页面*
    for (const user_page of document.querySelectorAll(selector.user_page.frame)) {
      if (user_page.querySelector(selector.user_page.id)) {
        const user_page_id = user_page.querySelector(selector.user_page.id).textContent;

        if (!user_id || user_id == user_page_id) {
          const user_page_tag = user_page.querySelector('.note-obj-user-tag');
          user_page_tag && user_page_tag.remove();
          note_obj.judgeUsers(user_page_id) &&
            user_page.querySelector(selector.user_page.box).after(
              note_obj.createNoteTag(
                user_page_id,
                {
                  secondaryColor: false,
                  offsetWidth: -20,
                },
                'div',
                ['note-obj-ins-userpage-tag', 'note-obj-ins-font-blue-color', 'note-obj-ins-font-bold']
              )
            );
        }
      }

      // 处理共同关注人 id
      for (const common_user of user_page.querySelectorAll(selector.user_page.common)) {
        const common_user_id = common_user.textContent;

        if (!user_id || user_id == common_user_id) {
          if (note_obj.judgeUsers(common_user_id)) {
            common_user.title = note_obj.getUserTag(common_user_id);
            if (note_obj.getShowNoteColorConfig()) {
              common_user.style.setProperty('color', note_obj.getPrimaryColor(common_user_id), 'important');
            } else {
              common_user.style.setProperty('color', '');
            }
            common_user.classList.add('note-obj-ins-font-blue-color');
          } else {
            (common_user.title = ''), common_user.style.setProperty('color', '');
            common_user.classList.remove('note-obj-ins-font-blue-color');
          }
        }
      }

      // ver.4.0.1 处理信息简介里的 @ 用户
      for (const info_at_user of user_page.querySelectorAll(selector.user_page.info_at)) {
        const info_at_user_id = Note_Obj.fn.getUserIdFromLink(info_at_user.href);

        (!user_id || user_id == info_at_user_id) &&
          note_obj.handler(info_at_user_id, info_at_user, null, {
            symbol: {
              prefix: '@',
            },
            classname: 'note-obj-ins-font-blue-color',
            title: true,
          });
      }
    }

    // *处理快拍页面*
    for (const stories_shell of document.querySelectorAll(selector.stories.id_shell)) {
      const stories = stories_shell.querySelector(selector.stories.id);
      if (stories) {
        const stories_user_id = Note_Obj.fn.getUserIdFromLink(stories.href);

        (!user_id || user_id == stories_user_id) &&
          note_obj.handler(stories_user_id, stories, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }
    }

    // *处理关注列表页面*
    for (const initial of document.querySelectorAll(selector.watch_list.initial_item)) {
      const initial_item = initial.querySelector(selector.watch_list.id);
      if (initial_item) {
        const initial_item_id = Note_Obj.fn.getUserIdFromLink(initial_item.href);

        (!user_id || user_id == initial_item_id) &&
          note_obj.handler(initial_item_id, initial_item, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }
    }
    for (const later of document.querySelectorAll(selector.watch_list.later_item)) {
      const later_item = later.querySelector(selector.watch_list.id);
      if (later_item) {
        const later_item_id = Note_Obj.fn.getUserIdFromLink(later_item.href);

        (!user_id || user_id == later_item_id) &&
          note_obj.handler(later_item_id, later_item, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }
    }

    // *处理用户主页点击单张图片后的弹出框*
    for (const dialog of document.querySelectorAll(selector.dialog.frame)) {
      const dialog_a = dialog.querySelector(selector.homepage.id);
      if (dialog_a) {
        const dialog_a_id = Note_Obj.fn.getUserIdFromLink(dialog_a.href);

        (!user_id || user_id == dialog_a_id) &&
          note_obj.handler(dialog_a_id, dialog_a, null, {
            title: true,
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理点赞里的用户
      for (const like of dialog.querySelectorAll(selector.homepage.comment_id)) {
        /** 点赞者 id */
        const like_id = Note_Obj.fn.getUserIdFromLink(like.href);

        (!user_id || user_id == like_id) &&
          note_obj.judgeUsers(like_id) &&
          note_obj.handler(like_id, like, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理评论里的用户
      for (const comment_user of dialog.querySelectorAll(selector.dialog.comment_id)) {
        const comment_id = Note_Obj.fn.getUserIdFromLink(comment_user.href);

        (!user_id || user_id == comment_id) &&
          note_obj.handler(comment_id, comment_user, null, {
            classname: 'note-obj-ins-font-blue-color',
            title: true,
          });
      }

      // 处理评论里 @ 的用户
      for (const comment_at of dialog.querySelectorAll(selector.dialog.comment_at)) {
        const comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);

        (!user_id || user_id == comment_at_id) &&
          note_obj.handler(comment_at_id, comment_at, null, {
            symbol: {
              prefix: '@',
            },
            classname: 'note-obj-ins-font-blue-color',
            title: true,
          });
      }
    }

    // *处理顶部爱心按钮展开的请求关注列表*
    for (const follow of document.querySelectorAll(selector.request.follow)) {
      const follow_user_id = Note_Obj.fn.getUserIdFromLink(follow.href);

      (!user_id || user_id == follow_user_id) &&
        note_obj.handler(follow_user_id, follow, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    }

    // ver.4.0.2 处理推荐列表里的用户
    for (const suggest_user of document.querySelectorAll(selector.suggest.user)) {
      const suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest_user.href);

      (!user_id || user_id == suggest_user_id) &&
        note_obj.handler(suggest_user_id, suggest_user, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    }

    // *处理匹配已关注用户的下拉推荐内容*
    for (const suggest of document.querySelectorAll(selector.user_page.suggest)) {
      const suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest.href);

      (!user_id || user_id == suggest_user_id) &&
        note_obj.handler(suggest_user_id, suggest, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    }
  }

  /**
   * ins 主页用户 id 替换选项变动事件
   * - ver.5.2.0 +
   * @param {*} newValue
   * @param {*} oldValue
   */
  function instagram_Homepage_Event(newValue, oldValue) {
    if (newValue != oldValue) {
      for (const article of document.querySelectorAll(selector.homepage.article)) {
        const article_user = article.querySelector(selector.homepage.id);
        if (article_user) {
          /** 用户主 id */
          const article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);

          // 先强制清除备注
          note_obj.handler(article_user_id, article_user, null, {
            add: oldValue ? null : 'span',
            classname: oldValue ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
            title: oldValue,
            restore: true,
          });

          // 再处理新值
          note_obj.handler(article_user_id, article_user, null, {
            add: newValue ? null : 'span',
            classname: newValue ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
            title: newValue,
          });
        }
      }
    }
  }

  /**
   * Instagram 初始化函数
   * @param{Note_Obj} note_obj 备注对象实例
   */
  function init_Instagram(note_obj) {
    /** 到达事件选项对象 */
    const arrive_option = {
      fireOnAttributesModification: true,
      existing: true,
    };

    // 移动端添加搜索按钮
    Note_Obj.fn.isMobilePage() &&
      document.body.arrive(selector.mobile.bottom_bar, arrive_option, item =>
        item.appendChild(note_obj.createSearchButton('note-obj-ins-mobile-search-button'))
      );

    // **开始操作标签**

    // *主页左侧的图片窗口*
    document.body.arrive(selector.homepage.article, arrive_option, article => {
      // 添加备注
      const article_user = article.querySelector(selector.homepage.id);
      if (article_user) {
        /** 用户主 id */
        const article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);

        // 用户位于记录中
        note_obj.judgeUsers(article_user_id) &&
          note_obj.handler(article_user_id, article_user, null, {
            add: note_obj.getConfig().other.replaceHomepageID ? null : 'span',
            classname: note_obj.getConfig().other.replaceHomepageID ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
            title: note_obj.getConfig().other.replaceHomepageID,
          });

        // 添加备注图标
        article.querySelector(selector.homepage.icon) &&
          article
            .querySelector(selector.homepage.icon)
            .insertAdjacentElement(
              'beforebegin',
              note_obj.createNoteBtn(article_user_id, null, ['note-obj-ins-add-btn', 'note-obj-ins-homepage-btn'], 'span')
            );
      }

      // 处理评论区用户
      for (const comment of article.querySelectorAll(selector.homepage.comment_id)) {
        /** 评论者 id */
        const comment_id = Note_Obj.fn.getUserIdFromLink(comment.href);

        // 评论者位于记录中
        note_obj.judgeUsers(comment_id) &&
          note_obj.handler(comment_id, comment, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理评论里的 @ 用户,*因为可能存在后续加载,所以采用绑定事件的方法*
      article.arrive(selector.homepage.comment_at, arrive_option, comment_at => {
        const comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);

        // @ 用户位于记录中
        note_obj.judgeUsers(comment_at_id) &&
          note_obj.handler(comment_at_id, comment_at, null, {
            symbol: {
              prefix: '@',
            },
            title: true,
            classname: 'note-obj-ins-font-blue-color',
          });
      });

      // 处理单图片页面评论里的用户
      article.arrive(selector.dialog.comment_id, arrive_option, pic_comment_user => {
        const pic_comment_id = Note_Obj.fn.getUserIdFromLink(pic_comment_user.href);

        // 用户位于记录中
        note_obj.judgeUsers(pic_comment_id) &&
          note_obj.handler(pic_comment_id, pic_comment_user, null, {
            title: true,
            classname: 'note-obj-ins-font-blue-color',
          });
      });

      // 处理单图片页面评论里 @ 的用户
      article.arrive(selector.dialog.comment_at, arrive_option, pic_comment_at => {
        // 需要找机会进行测试
        if (!pic_comment_at.classList.contains(selector.homepage.comment_id.replace(/^\.|\s+.*$/g, ''))) {
          const pic_comment_at_id = Note_Obj.fn.getUserIdFromLink(pic_comment_at.href);

          note_obj.judgeUsers(pic_comment_at_id) &&
            note_obj.handler(pic_comment_at_id, pic_comment_at, null, {
              symbol: {
                prefix: '@',
              },
              title: true,
              classname: 'note-obj-ins-font-blue-color',
            });
        }
      });
    });

    // *主页顶部的快拍窗口*
    document.body.arrive(selector.homepage_stories.id_shell, arrive_option, homepage_stories => {
      if (homepage_stories.querySelector(selector.homepage_stories.id)) {
        const homepage_stories_id = homepage_stories.querySelector(selector.homepage_stories.id).textContent;
        if (note_obj.judgeUsers(homepage_stories_id)) {
          // 用户位于记录中
          homepage_stories.title = note_obj.getUserTag(homepage_stories_id);
        }
      }
    });

    // *主页右侧的推荐关注*
    document.body.arrive(selector.homepage_recommend.id, arrive_option, homepage_recommend => {
      const homepage_recommend_id = Note_Obj.fn.getUserIdFromLink(homepage_recommend.href);

      note_obj.judgeUsers(homepage_recommend_id) &&
        note_obj.handler(homepage_recommend_id, homepage_recommend, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    });

    // *用户页面*
    document.body.arrive(selector.user_page.frame, arrive_option, user_page => {
      if (user_page.querySelector(selector.user_page.id)) {
        const user_page_id = user_page.querySelector(selector.user_page.id).textContent;

        /**
         * 用户名
         * - ver.4.0.0 +
         */
        const user_name = user_page.querySelector(selector.user_page.user_name);
        let user_name_text = '';
        if (user_name) {
          user_name_text = user_page.querySelector(selector.user_page.user_name).textContent;
        }

        // 添加备注按钮
        user_page.querySelector(selector.user_page.bar) &&
          user_page
            .querySelector(selector.user_page.bar)
            .after(note_obj.createNoteBtn(user_page_id, user_name_text, ['note-obj-ins-add-btn', 'note-obj-ins-userpage-btn']));

        // 添加备注标签
        note_obj.judgeUsers(user_page_id) &&
          user_page.querySelector(selector.user_page.box).after(
            note_obj.createNoteTag(
              user_page_id,
              {
                secondaryColor: false,
                offsetWidth: -20,
              },
              'div',
              ['note-obj-ins-userpage-tag', 'note-obj-ins-font-blue-color', 'note-obj-ins-font-bold'],
              user_name_text
            )
          );
      }

      // 处理共同关注人 id
      for (const common_user of user_page.querySelectorAll(selector.user_page.common)) {
        const common_user_id = common_user.textContent;
        if (note_obj.judgeUsers(common_user_id)) {
          common_user.title = note_obj.getUserTag(common_user_id);
          note_obj.getShowNoteColorConfig() &&
            common_user.style.setProperty('color', note_obj.getPrimaryColor(common_user_id), 'important');
          common_user.classList.add('note-obj-ins-font-blue-color');
        }
      }

      // ver.4.0.1 处理信息简介里的 @ 用户
      for (const info_at_user of user_page.querySelectorAll(selector.user_page.info_at)) {
        const info_at_user_id = Note_Obj.fn.getUserIdFromLink(info_at_user.href);

        note_obj.judgeUsers(info_at_user_id) &&
          note_obj.handler(info_at_user_id, info_at_user, null, {
            symbol: {
              prefix: '@',
            },
            classname: 'note-obj-ins-font-blue-color',
            title: true,
          });
      }
    });

    // *快拍页面*
    document.body.arrive(selector.stories.id_shell, arrive_option, stories_shell => {
      const stories = stories_shell.querySelector(selector.stories.id);
      if (stories) {
        const stories_user_id = Note_Obj.fn.getUserIdFromLink(stories.href);

        note_obj.judgeUsers(stories_user_id) &&
          note_obj.handler(stories_user_id, stories, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      //! 监测快拍用户切换时的 href 变化
      const userIdChange = new MutationObserver(() => {
        const newUserId = Note_Obj.fn.getUserIdFromLink(stories.href);
        if (note_obj.judgeUsers(newUserId)) {
          note_obj.handler(newUserId, stories, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
        } else {
          //* 清空备注
          note_obj.handler(newUserId, stories, null, {
            restore: true,
          });
        }
      });
      userIdChange.observe(stories, {
        attributeFilter: ['href'],
      });
    });

    // *关注列表页面*
    document.querySelector(selector.body).arrive(selector.watch_list.initial_item, arrive_option, initial => {
      const initial_item = initial.querySelector(selector.watch_list.id);
      if (initial_item) {
        const initial_item_id = Note_Obj.fn.getUserIdFromLink(initial_item.href);

        note_obj.judgeUsers(initial_item_id) &&
          note_obj.handler(initial_item_id, initial_item, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }
    });
    document.querySelector(selector.body).arrive(selector.watch_list.later_item, arrive_option, later => {
      const later_item = later.querySelector(selector.watch_list.id);
      if (later_item) {
        const later_item_id = Note_Obj.fn.getUserIdFromLink(later_item.href);

        note_obj.judgeUsers(later_item_id) &&
          note_obj.handler(later_item_id, later_item, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }
    });

    // *用户主页点击单张图片后的弹出框*
    document.querySelector(selector.body).arrive(selector.dialog.frame, arrive_option, dialog => {
      const dialog_a = dialog.querySelector(selector.homepage.id);
      if (dialog_a) {
        const dialog_a_id = Note_Obj.fn.getUserIdFromLink(dialog_a.href);

        note_obj.judgeUsers(dialog_a_id) &&
          note_obj.handler(dialog_a_id, dialog_a, null, {
            title: true,
            classname: 'note-obj-ins-font-blue-color',
          });

        // 添加备注按钮
        dialog.querySelector(selector.homepage.icon) &&
          dialog
            .querySelector(selector.homepage.icon)
            .insertAdjacentElement(
              'beforebegin',
              note_obj.createNoteBtn(dialog_a_id, null, ['note-obj-ins-add-btn', 'note-obj-ins-homepage-btn'], 'span')
            );
      }

      // 点赞里的用户
      for (const like of dialog.querySelectorAll(selector.homepage.comment_id)) {
        /** 点赞者 id */
        const like_id = Note_Obj.fn.getUserIdFromLink(like.href);

        // 点赞者位于记录中
        note_obj.judgeUsers(like_id) &&
          note_obj.handler(like_id, like, null, {
            classname: 'note-obj-ins-font-blue-color',
          });
      }

      // 处理评论里的用户,*因为可能存在后续加载,所以采用绑定事件的方法*
      dialog.arrive(selector.dialog.comment_id, arrive_option, comment_user => {
        const comment_id = Note_Obj.fn.getUserIdFromLink(comment_user.href);

        // 用户位于记录中
        note_obj.judgeUsers(comment_id) &&
          note_obj.handler(comment_id, comment_user, null, {
            classname: 'note-obj-ins-font-blue-color',
            title: true,
          });
      });

      // 处理评论里 @ 的用户
      dialog.arrive(selector.dialog.comment_at, arrive_option, comment_at => {
        const comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);

        note_obj.judgeUsers(comment_at_id) &&
          note_obj.handler(comment_at_id, comment_at, null, {
            symbol: {
              prefix: '@',
            },
            classname: 'note-obj-ins-font-blue-color',
            title: true,
          });
      });
    });

    // *顶部爱心按钮展开的请求关注列表*
    document.body.arrive(selector.request.follow, arrive_option, follow => {
      const follow_user_id = Note_Obj.fn.getUserIdFromLink(follow.href);

      note_obj.judgeUsers(follow_user_id) &&
        note_obj.handler(follow_user_id, follow, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    });

    // ver.4.0.2 适配推荐列表里的用户
    // https://www.instagram.com/explore/people/
    document.body.arrive(selector.suggest.user, arrive_option, suggest_user => {
      const suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest_user.href);

      note_obj.judgeUsers(suggest_user_id) &&
        note_obj.handler(suggest_user_id, suggest_user, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    });

    // ver.3.1.0 *匹配已关注用户的下拉推荐内容*
    document.body.arrive(selector.user_page.suggest, arrive_option, suggest => {
      const suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest.href);

      note_obj.judgeUsers(suggest_user_id) &&
        note_obj.handler(suggest_user_id, suggest, null, {
          classname: 'note-obj-ins-font-blue-color',
        });
    });
  }

  //* 初始化操作
  /** 备注对象实例 */
  const note_obj = new Note_Obj('myInstagramNote');

  // 对象初始化
  await note_obj.init({
    style: INS_STYLE,
    changeEvent: instagram_Change_Event,
    script: {
      author: {
        name: 'pana',
        homepage: 'https://greasyfork.org/zh-CN/users/193133-pana',
      },
      address: 'https://greasyfork.org/scripts/387871',
      updated: updated,
      library: [
        {
          name: 'arrive.js',
          version: '2.4.1',
          url: 'https://github.com/uzairfarooq/arrive',
        },
      ],
    },
    primaryColor: '#336699',
    settings: {
      replaceHomepageID: {
        type: 'checkbox',
        lang: {
          en: 'Allow to replace the user ID on the instagram homepage',
          zh_cn: '允许替换 Instagram 首页上的用户 ID',
          zh_tw: '允許替換 Instagram 首頁上的用戶 ID',
          ja: 'Instagram ホームページのユーザーIDの置き換えを許可する',
          ko: 'Instagram 첫 페이지에 있는 사용자 ID 바꾸기 허용',
          fr: "Permettre de remplacer l'ID utilisateur sur la page d'accueil Instagram",
        },
        default: true,
        event: instagram_Homepage_Event,
      },
    },
    leftBtnBoxClassName: 'note-obj-ins-left-box',
  });

  init_Instagram(note_obj);
})();