Instagram - 为用户添加备注(别名/标签)

为用户添加备注(别名/标签)功能,以帮助识别和搜索

目前为 2022-06-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Instagram为关注用户添加备注
  3. // @name:en Instagram - Add notes(aliases/tags) to the user
  4. // @name:zh-CN Instagram - 为用户添加备注(别名/标签)
  5. // @name:zh-TW Instagram - 為用戶添加備註(別名/標籤)
  6. // @name:ja Instagram - ユーザーへのメモの追加(エイリアス/ラベル)
  7. // @name:ko Instagram - 사용자에게 메모 추가 (별칭/라벨)
  8. // @name:fr Instagram - ajouter des notes aux utilisateurs (alias/tag)
  9. // @namespace https://greasyfork.org/zh-CN/users/193133-pana
  10. // @homepage https://greasyfork.org/zh-CN/users/193133-pana
  11. // @icon data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9Im5ld0ljb25UaXRsZSIgc3Ryb2tlPSJyZ2JhKDI5LDE2MSwyNDIsMS4wMCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYmEoMjksMTYxLDI0MiwxLjAwKSI+IDx0aXRsZSBpZD0ibmV3SWNvblRpdGxlIj5OZXc8L3RpdGxlPiA8cGF0aCBkPSJNMTkgMTRWMjJIMi45OTk5N1Y0SDEzIi8+IDxwYXRoIGQ9Ik0xNy40NjA4IDQuMDM5MjFDMTguMjQxOCAzLjI1ODE3IDE5LjUwODIgMy4yNTgxNiAyMC4yODkyIDQuMDM5MjFMMjAuOTYwOCA0LjcxMDc5QzIxLjc0MTggNS40OTE4NCAyMS43NDE4IDYuNzU4MTcgMjAuOTYwOCA3LjUzOTIxTDExLjU4NTggMTYuOTE0MkMxMS4yMTA3IDE3LjI4OTMgMTAuNzAyIDE3LjUgMTAuMTcxNiAxNy41TDcuNSAxNy41TDcuNSAxNC44Mjg0QzcuNSAxNC4yOTggNy43MTA3MSAxMy43ODkzIDguMDg1NzkgMTMuNDE0MkwxNy40NjA4IDQuMDM5MjFaIi8+IDxwYXRoIGQ9Ik0xNi4yNSA1LjI1TDE5Ljc1IDguNzUiLz4gPC9zdmc+
  12. // @version 5.3.5
  13. // @description 为用户添加备注(别名/标签)功能,以帮助识别和搜索
  14. // @description:en Add a note(alias/tag) for users to help identify and search
  15. // @description:zh-CN 为用户添加备注(别名/标签)功能,以帮助识别和搜索
  16. // @description:zh-TW 為用戶添加備註(別名/標籤)功能,以幫助識別和搜尋
  17. // @description:ja ユーザーが識別と検索に役立つメモ(エイリアス/タグ)機能を追加する
  18. // @description:ko 사용자 식별 및 검색에 도움이되는 메모 (별칭/태그) 기능 추가
  19. // @description:fr Ajouter une fonction de notes (alias/tag) pour les utilisateurs pour aider à identifier et rechercher
  20. // @license GNU General Public License v3.0 or later
  21. // @compatible chrome
  22. // @compatible firefox
  23. // @author pana
  24. // @include http*://*instagram.com/*
  25. // @require https://cdn.jsdelivr.net/npm/arrive@2.4.1/minified/arrive.min.js
  26. // @require https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js
  27. // @require https://cdn.jsdelivr.net/gh/LightAPIs/greasy-fork-library@d07ae4ecc5829d3674761f3069f8801b429bab49/Note_Obj.js
  28. // @grant GM_info
  29. // @grant GM.info
  30. // @grant GM_getValue
  31. // @grant GM.getValue
  32. // @grant GM_setValue
  33. // @grant GM.setValue
  34. // @grant GM_deleteValue
  35. // @grant GM.deleteValue
  36. // @grant GM_listValues
  37. // @grant GM.listValues
  38. // @grant GM_openInTab
  39. // @grant GM.openInTab
  40. // @grant GM_registerMenuCommand
  41. // @grant GM_unregisterMenuCommand
  42. // @grant GM_addValueChangeListener
  43. // @grant GM_removeValueChangeListener
  44. // ==/UserScript==
  45.  
  46. (async function () {
  47. 'use strict';
  48. if (typeof Note_Obj !== 'function') {
  49. alert('Note_Obj.js was not loaded successfully!');
  50. }
  51. const updated = '2022-06-01';
  52. const INS_ICON = {
  53. NOTE_BLACK:
  54. 'url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9Im5ld0ljb25UaXRsZSIgc3Ryb2tlPSJyZ2IoMzgsIDM4LCAzOCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYigzOCwgMzgsIDM4KSI+IDx0aXRsZSBpZD0ibmV3SWNvblRpdGxlIj5OZXc8L3RpdGxlPiA8cGF0aCBkPSJNMTkgMTRWMjJIMi45OTk5N1Y0SDEzIi8+IDxwYXRoIGQ9Ik0xNy40NjA4IDQuMDM5MjFDMTguMjQxOCAzLjI1ODE3IDE5LjUwODIgMy4yNTgxNiAyMC4yODkyIDQuMDM5MjFMMjAuOTYwOCA0LjcxMDc5QzIxLjc0MTggNS40OTE4NCAyMS43NDE4IDYuNzU4MTcgMjAuOTYwOCA3LjUzOTIxTDExLjU4NTggMTYuOTE0MkMxMS4yMTA3IDE3LjI4OTMgMTAuNzAyIDE3LjUgMTAuMTcxNiAxNy41TDcuNSAxNy41TDcuNSAxNC44Mjg0QzcuNSAxNC4yOTggNy43MTA3MSAxMy43ODkzIDguMDg1NzkgMTMuNDE0MkwxNy40NjA4IDQuMDM5MjFaIi8+IDxwYXRoIGQ9Ik0xNi4yNSA1LjI1TDE5Ljc1IDguNzUiLz4gPC9zdmc+)',
  55. SERACH_BLUE:
  56. 'url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9InNlYXJjaEljb25UaXRsZSIgc3Ryb2tlPSJyZ2JhKDI5LDE2MSwyNDIsMS4wMCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYmEoMjksMTYxLDI0MiwxLjAwKSI+IDx0aXRsZSBpZD0ic2VhcmNoSWNvblRpdGxlIj5TZWFyY2g8L3RpdGxlPiA8cGF0aCBkPSJNMTQuNDEyMTEyMiwxNC40MTIxMTIyIEwyMCwyMCIvPiA8Y2lyY2xlIGN4PSIxMCIgY3k9IjEwIiByPSI2Ii8+IDwvc3ZnPg==)',
  57. };
  58. const INS_STYLE = `
  59. .note-obj-ins-font-blue-color {
  60. color: #336699;
  61. }
  62. .note-obj-ins-background-box {
  63. display: inline-block;
  64. align-items: center;
  65. white-space: nowrap;
  66. border-radius: 50px;
  67. padding: 0px 10px;
  68. background-color: #336699;
  69. color: #fff;
  70. }
  71. .note-obj-ins-add-btn {
  72. background-image: ${INS_ICON.NOTE_BLACK};
  73. background-size: 24px;
  74. background-repeat: no-repeat;
  75. background-position: center;
  76. margin-left: 5px;
  77. cursor: pointer;
  78. width: 24px;
  79. height: 24px;
  80. }
  81. .note-obj-ins-homepage-btn {
  82. margin: 6px !important;
  83. }
  84. .note-obj-ins-homepage-btn:hover {
  85. opacity: 0.5;
  86. }
  87. .note-obj-ins-userpage-btn {
  88. margin-top: 2px;
  89. }
  90. .note-obj-ins-userpage-tag {
  91. display: block;
  92. font-size: 20px;
  93. margin-bottom: 20px;
  94. white-space: nowrap;
  95. }
  96. .note-obj-ins-mobile-search-button {
  97. background-image: ${INS_ICON.SERACH_BLUE};
  98. background-size: 24px;
  99. background-repeat: no-repeat;
  100. background-position: center;
  101. cursor: pointer;
  102. min-width: 0px;
  103. height: 100%;
  104. flex: 1 1 auto;
  105. }
  106. .note-obj-ins-font-bold {
  107. font-weight: bold;
  108. }
  109. .note-obj-veryins-blue-tag {
  110. background-color: #3c81df;
  111. color: #fff;
  112. display: inline-flex;
  113. align-items: center;
  114. padding: 0px 10px;
  115. white-space: nowrap;
  116. line-height: 100%;
  117. border-radius: 50px;
  118. padding: 2px 10px;
  119. }
  120. .note-obj-veryins-userpage-btn {
  121. display: inline-block;
  122. vertical-align: middle;
  123. }
  124. `;
  125. var selector = {
  126. body: 'body',
  127. homepage: {
  128. article: 'article',
  129. id: '._aaqt a',
  130. id_shell: '._aaqt',
  131. icon: 'span._aamz',
  132. comment_id: '._aap6._aap7._aap8 a',
  133. comment_at: '._aat6 ._aade > .notranslate',
  134. },
  135. homepage_stories: {
  136. id: '._aamb._aamc',
  137. id_shell: '._aam8',
  138. },
  139. homepage_recommend: {
  140. id: '._aak3 ._aap6._aap7._aap8 a',
  141. },
  142. user_page: {
  143. frame: '._aa_h',
  144. id: '._aa_m h2',
  145. bar: '._aa_n',
  146. box: '._aa_m',
  147. common: 'span._aaai',
  148. suggest: '._acj1 a.notranslate',
  149. info_at: '.notranslate',
  150. user_name: '._aa_c > span',
  151. },
  152. watch_list: {
  153. initial_item: '._aae- li',
  154. later_item: '._aaei',
  155. id: '._aap6._aap7._aap8 a',
  156. },
  157. dialog: {
  158. frame: '._a3gq article',
  159. comment_id: '._a9zm ._aap6._aap7._aap8 a',
  160. comment_at: '._a9zs .notranslate',
  161. },
  162. request: {
  163. follow: '.yrJyr',
  164. },
  165. mobile: {
  166. bottom_bar: '._abp7',
  167. },
  168. suggest: {
  169. user: '.FPmhX.notranslate.MBL3Z',
  170. },
  171. };
  172. function instagram_Change_Event(note_obj, user_id = null) {
  173. for (let article of document.querySelectorAll(selector.homepage.article)) {
  174. let article_user = article.querySelector(selector.homepage.id);
  175. if (article_user) {
  176. let article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);
  177. (!user_id || user_id == article_user_id) &&
  178. note_obj.handler(article_user_id, article_user, null, {
  179. add: note_obj.getConfig().other.replaceHomepageID ? null : 'span',
  180. classname: note_obj.getConfig().other.replaceHomepageID ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
  181. title: note_obj.getConfig().other.replaceHomepageID,
  182. });
  183. }
  184. for (let comment of article.querySelectorAll(selector.homepage.comment_id)) {
  185. let comment_id = Note_Obj.fn.getUserIdFromLink(comment.href);
  186. (!user_id || user_id == comment_id) &&
  187. note_obj.handler(comment_id, comment, null, {
  188. classname: 'note-obj-ins-font-blue-color',
  189. });
  190. }
  191. for (let comment_at of article.querySelectorAll(selector.homepage.comment_at)) {
  192. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  193. (!user_id || user_id == comment_at_id) &&
  194. note_obj.handler(comment_at_id, comment_at, null, {
  195. symbol: {
  196. prefix: '@',
  197. },
  198. title: true,
  199. classname: 'note-obj-ins-font-blue-color',
  200. });
  201. }
  202. for (let pic_comment_user of article.querySelectorAll(selector.dialog.comment_id)) {
  203. let pic_comment_id = Note_Obj.fn.getUserIdFromLink(pic_comment_user.href);
  204. (!user_id || user_id == pic_comment_id) &&
  205. note_obj.handler(pic_comment_id, pic_comment_user, null, {
  206. title: true,
  207. classname: 'note-obj-ins-font-blue-color',
  208. });
  209. }
  210. for (let pic_comment_at of article.querySelectorAll(selector.dialog.comment_at)) {
  211. if (!pic_comment_at.classList.contains(selector.homepage.comment_id.replace(/^\.|\s+.*$/g, ''))) {
  212. let pic_comment_at_id = Note_Obj.fn.getUserIdFromLink(pic_comment_at.href);
  213. (!user_id || user_id == pic_comment_at_id) &&
  214. note_obj.handler(pic_comment_at_id, pic_comment_at, null, {
  215. symbol: {
  216. prefix: '@',
  217. },
  218. title: true,
  219. classname: 'note-obj-ins-font-blue-color',
  220. });
  221. }
  222. }
  223. }
  224. for (let homepage_stories of document.querySelectorAll(selector.homepage_stories.id_shell)) {
  225. if (homepage_stories.querySelector(selector.homepage_stories.id)) {
  226. let homepage_stories_id = homepage_stories.querySelector(selector.homepage_stories.id).textContent;
  227. if (!user_id || user_id == homepage_stories_id) {
  228. homepage_stories.title = note_obj.getUserTag(homepage_stories_id);
  229. }
  230. }
  231. }
  232. for (let homepage_recommend of document.querySelectorAll(selector.homepage_recommend.id)) {
  233. let homepage_recommend_id = Note_Obj.fn.getUserIdFromLink(homepage_recommend.href);
  234. (!user_id || user_id == homepage_recommend_id) &&
  235. note_obj.handler(homepage_recommend_id, homepage_recommend, null, {
  236. classname: 'note-obj-ins-font-blue-color',
  237. });
  238. }
  239. for (let user_page of document.querySelectorAll(selector.user_page.frame)) {
  240. if (user_page.querySelector(selector.user_page.id)) {
  241. let user_page_id = user_page.querySelector(selector.user_page.id).textContent;
  242. if (!user_id || user_id == user_page_id) {
  243. let user_page_tag = user_page.querySelector('.note-obj-user-tag');
  244. user_page_tag && user_page_tag.remove();
  245. note_obj.judgeUsers(user_page_id) &&
  246. user_page.querySelector(selector.user_page.box).after(
  247. note_obj.createNoteTag(
  248. user_page_id,
  249. {
  250. secondaryColor: false,
  251. offsetWidth: -20,
  252. },
  253. 'div',
  254. ['note-obj-ins-userpage-tag', 'note-obj-ins-font-blue-color', 'note-obj-ins-font-bold']
  255. )
  256. );
  257. }
  258. }
  259. for (let common_user of user_page.querySelectorAll(selector.user_page.common)) {
  260. let common_user_id = common_user.textContent;
  261. if (!user_id || user_id == common_user_id) {
  262. if (note_obj.judgeUsers(common_user_id)) {
  263. common_user.title = note_obj.getUserTag(common_user_id);
  264. if (note_obj.getShowNoteColorConfig()) {
  265. common_user.style.setProperty('color', note_obj.getPrimaryColor(common_user_id), 'important');
  266. } else {
  267. common_user.style.setProperty('color', '');
  268. }
  269. common_user.classList.add('note-obj-ins-font-blue-color');
  270. } else {
  271. (common_user.title = ''), common_user.style.setProperty('color', '');
  272. common_user.classList.remove('note-obj-ins-font-blue-color');
  273. }
  274. }
  275. }
  276. for (let info_at_user of user_page.querySelectorAll(selector.user_page.info_at)) {
  277. let info_at_user_id = Note_Obj.fn.getUserIdFromLink(info_at_user.href);
  278. (!user_id || user_id == info_at_user_id) &&
  279. note_obj.handler(info_at_user_id, info_at_user, null, {
  280. symbol: {
  281. prefix: '@',
  282. },
  283. classname: 'note-obj-ins-font-blue-color',
  284. title: true,
  285. });
  286. }
  287. }
  288. for (let initial of document.querySelectorAll(selector.watch_list.initial_item)) {
  289. let initial_item = initial.querySelector(selector.watch_list.id);
  290. if (initial_item) {
  291. let initial_item_id = Note_Obj.fn.getUserIdFromLink(initial_item.href);
  292. (!user_id || user_id == initial_item_id) &&
  293. note_obj.handler(initial_item_id, initial_item, null, {
  294. classname: 'note-obj-ins-font-blue-color',
  295. });
  296. }
  297. }
  298. for (let later of document.querySelectorAll(selector.watch_list.later_item)) {
  299. let later_item = later.querySelector(selector.watch_list.id);
  300. if (later_item) {
  301. let later_item_id = Note_Obj.fn.getUserIdFromLink(later_item.href);
  302. (!user_id || user_id == later_item_id) &&
  303. note_obj.handler(later_item_id, later_item, null, {
  304. classname: 'note-obj-ins-font-blue-color',
  305. });
  306. }
  307. }
  308. for (let dialog of document.querySelectorAll(selector.dialog.frame)) {
  309. let dialog_a = dialog.querySelector(selector.homepage.id);
  310. if (dialog_a) {
  311. let dialog_a_id = Note_Obj.fn.getUserIdFromLink(dialog_a.href);
  312. (!user_id || user_id == dialog_a_id) &&
  313. note_obj.handler(dialog_a_id, dialog_a, null, {
  314. title: true,
  315. classname: 'note-obj-ins-font-blue-color',
  316. });
  317. }
  318. for (let like of dialog.querySelectorAll(selector.homepage.comment_id)) {
  319. let like_id = Note_Obj.fn.getUserIdFromLink(like.href);
  320. (!user_id || user_id == like_id) &&
  321. note_obj.judgeUsers(like_id) &&
  322. note_obj.handler(like_id, like, null, {
  323. classname: 'note-obj-ins-font-blue-color',
  324. });
  325. }
  326. for (let comment_user of dialog.querySelectorAll(selector.dialog.comment_id)) {
  327. let comment_id = Note_Obj.fn.getUserIdFromLink(comment_user.href);
  328. (!user_id || user_id == comment_id) &&
  329. note_obj.handler(comment_id, comment_user, null, {
  330. classname: 'note-obj-ins-font-blue-color',
  331. title: true,
  332. });
  333. }
  334. for (let comment_at of dialog.querySelectorAll(selector.dialog.comment_at)) {
  335. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  336. (!user_id || user_id == comment_at_id) &&
  337. note_obj.handler(comment_at_id, comment_at, null, {
  338. symbol: {
  339. prefix: '@',
  340. },
  341. classname: 'note-obj-ins-font-blue-color',
  342. title: true,
  343. });
  344. }
  345. }
  346. for (let follow of document.querySelectorAll(selector.request.follow)) {
  347. let follow_user_id = Note_Obj.fn.getUserIdFromLink(follow.href);
  348. (!user_id || user_id == follow_user_id) &&
  349. note_obj.handler(follow_user_id, follow, null, {
  350. classname: 'note-obj-ins-font-blue-color',
  351. });
  352. }
  353. for (let suggest_user of document.querySelectorAll(selector.suggest.user)) {
  354. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest_user.href);
  355. (!user_id || user_id == suggest_user_id) &&
  356. note_obj.handler(suggest_user_id, suggest_user, null, {
  357. classname: 'note-obj-ins-font-blue-color',
  358. });
  359. }
  360. for (let suggest of document.querySelectorAll(selector.user_page.suggest)) {
  361. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest.href);
  362. (!user_id || user_id == suggest_user_id) &&
  363. note_obj.handler(suggest_user_id, suggest, null, {
  364. classname: 'note-obj-ins-font-blue-color',
  365. });
  366. }
  367. }
  368. function instagram_Homepage_Event(newValue, oldValue) {
  369. if (newValue != oldValue) {
  370. for (let article of document.querySelectorAll(selector.homepage.article)) {
  371. let article_user = article.querySelector(selector.homepage.id);
  372. if (article_user) {
  373. let article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);
  374. note_obj.handler(article_user_id, article_user, null, {
  375. add: oldValue ? null : 'span',
  376. classname: oldValue ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
  377. title: oldValue,
  378. restore: true,
  379. });
  380. note_obj.handler(article_user_id, article_user, null, {
  381. add: newValue ? null : 'span',
  382. classname: newValue ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
  383. title: newValue,
  384. });
  385. }
  386. }
  387. }
  388. }
  389. function init_Instagram(note_obj) {
  390. let arrive_option = {
  391. fireOnAttributesModification: true,
  392. existing: true,
  393. };
  394. Note_Obj.fn.isMobilePage() &&
  395. document.body.arrive(selector.mobile.bottom_bar, arrive_option, item =>
  396. item.appendChild(note_obj.createSearchButton('note-obj-ins-mobile-search-button'))
  397. );
  398. document.body.arrive(selector.homepage.article, arrive_option, article => {
  399. let article_user = article.querySelector(selector.homepage.id);
  400. if (article_user) {
  401. let article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);
  402. note_obj.judgeUsers(article_user_id) &&
  403. note_obj.handler(article_user_id, article_user, null, {
  404. add: note_obj.getConfig().other.replaceHomepageID ? null : 'span',
  405. classname: note_obj.getConfig().other.replaceHomepageID ? 'note-obj-ins-font-blue-color' : 'note-obj-ins-background-box',
  406. title: note_obj.getConfig().other.replaceHomepageID,
  407. });
  408. article.querySelector(selector.homepage.icon) &&
  409. article
  410. .querySelector(selector.homepage.icon)
  411. .insertAdjacentElement(
  412. 'beforebegin',
  413. note_obj.createNoteBtn(article_user_id, null, ['note-obj-ins-add-btn', 'note-obj-ins-homepage-btn'], 'span')
  414. );
  415. }
  416. for (let comment of article.querySelectorAll(selector.homepage.comment_id)) {
  417. let comment_id = Note_Obj.fn.getUserIdFromLink(comment.href);
  418. note_obj.judgeUsers(comment_id) &&
  419. note_obj.handler(comment_id, comment, null, {
  420. classname: 'note-obj-ins-font-blue-color',
  421. });
  422. }
  423. article.arrive(selector.homepage.comment_at, arrive_option, comment_at => {
  424. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  425. note_obj.judgeUsers(comment_at_id) &&
  426. note_obj.handler(comment_at_id, comment_at, null, {
  427. symbol: {
  428. prefix: '@',
  429. },
  430. title: true,
  431. classname: 'note-obj-ins-font-blue-color',
  432. });
  433. });
  434. article.arrive(selector.dialog.comment_id, arrive_option, pic_comment_user => {
  435. let pic_comment_id = Note_Obj.fn.getUserIdFromLink(pic_comment_user.href);
  436. note_obj.judgeUsers(pic_comment_id) &&
  437. note_obj.handler(pic_comment_id, pic_comment_user, null, {
  438. title: true,
  439. classname: 'note-obj-ins-font-blue-color',
  440. });
  441. });
  442. article.arrive(selector.dialog.comment_at, arrive_option, pic_comment_at => {
  443. if (!pic_comment_at.classList.contains(selector.homepage.comment_id.replace(/^\.|\s+.*$/g, ''))) {
  444. let pic_comment_at_id = Note_Obj.fn.getUserIdFromLink(pic_comment_at.href);
  445. note_obj.judgeUsers(pic_comment_at_id) &&
  446. note_obj.handler(pic_comment_at_id, pic_comment_at, null, {
  447. symbol: {
  448. prefix: '@',
  449. },
  450. title: true,
  451. classname: 'note-obj-ins-font-blue-color',
  452. });
  453. }
  454. });
  455. });
  456. document.body.arrive(selector.homepage_stories.id_shell, arrive_option, homepage_stories => {
  457. if (homepage_stories.querySelector(selector.homepage_stories.id)) {
  458. let homepage_stories_id = homepage_stories.querySelector(selector.homepage_stories.id).textContent;
  459. if (note_obj.judgeUsers(homepage_stories_id)) {
  460. homepage_stories.title = note_obj.getUserTag(homepage_stories_id);
  461. }
  462. }
  463. });
  464. document.body.arrive(selector.homepage_recommend.id, arrive_option, homepage_recommend => {
  465. let homepage_recommend_id = Note_Obj.fn.getUserIdFromLink(homepage_recommend.href);
  466. note_obj.judgeUsers(homepage_recommend_id) &&
  467. note_obj.handler(homepage_recommend_id, homepage_recommend, null, {
  468. classname: 'note-obj-ins-font-blue-color',
  469. });
  470. });
  471. document.body.arrive(selector.user_page.frame, arrive_option, user_page => {
  472. if (user_page.querySelector(selector.user_page.id)) {
  473. let user_page_id = user_page.querySelector(selector.user_page.id).textContent;
  474. let user_name = user_page.querySelector(selector.user_page.user_name);
  475. let user_name_text = '';
  476. if (user_name) {
  477. user_name_text = user_page.querySelector(selector.user_page.user_name).textContent;
  478. }
  479. user_page.querySelector(selector.user_page.bar) &&
  480. user_page
  481. .querySelector(selector.user_page.bar)
  482. .after(note_obj.createNoteBtn(user_page_id, user_name_text, ['note-obj-ins-add-btn', 'note-obj-ins-userpage-btn']));
  483. note_obj.judgeUsers(user_page_id) &&
  484. user_page.querySelector(selector.user_page.box).after(
  485. note_obj.createNoteTag(
  486. user_page_id,
  487. {
  488. secondaryColor: false,
  489. offsetWidth: -20,
  490. },
  491. 'div',
  492. ['note-obj-ins-userpage-tag', 'note-obj-ins-font-blue-color', 'note-obj-ins-font-bold'],
  493. user_name_text
  494. )
  495. );
  496. }
  497. for (let common_user of user_page.querySelectorAll(selector.user_page.common)) {
  498. let common_user_id = common_user.textContent;
  499. if (note_obj.judgeUsers(common_user_id)) {
  500. common_user.title = note_obj.getUserTag(common_user_id);
  501. note_obj.getShowNoteColorConfig() &&
  502. common_user.style.setProperty('color', note_obj.getPrimaryColor(common_user_id), 'important');
  503. common_user.classList.add('note-obj-ins-font-blue-color');
  504. }
  505. }
  506. for (let info_at_user of user_page.querySelectorAll(selector.user_page.info_at)) {
  507. let info_at_user_id = Note_Obj.fn.getUserIdFromLink(info_at_user.href);
  508. note_obj.judgeUsers(info_at_user_id) &&
  509. note_obj.handler(info_at_user_id, info_at_user, null, {
  510. symbol: {
  511. prefix: '@',
  512. },
  513. classname: 'note-obj-ins-font-blue-color',
  514. title: true,
  515. });
  516. }
  517. });
  518. document.querySelector(selector.body).arrive(selector.watch_list.initial_item, arrive_option, initial => {
  519. let initial_item = initial.querySelector(selector.watch_list.id);
  520. if (initial_item) {
  521. let initial_item_id = Note_Obj.fn.getUserIdFromLink(initial_item.href);
  522. note_obj.judgeUsers(initial_item_id) &&
  523. note_obj.handler(initial_item_id, initial_item, null, {
  524. classname: 'note-obj-ins-font-blue-color',
  525. });
  526. }
  527. });
  528. document.querySelector(selector.body).arrive(selector.watch_list.later_item, arrive_option, later => {
  529. let later_item = later.querySelector(selector.watch_list.id);
  530. if (later_item) {
  531. let later_item_id = Note_Obj.fn.getUserIdFromLink(later_item.href);
  532. note_obj.judgeUsers(later_item_id) &&
  533. note_obj.handler(later_item_id, later_item, null, {
  534. classname: 'note-obj-ins-font-blue-color',
  535. });
  536. }
  537. });
  538. document.querySelector(selector.body).arrive(selector.dialog.frame, arrive_option, dialog => {
  539. let dialog_a = dialog.querySelector(selector.homepage.id);
  540. if (dialog_a) {
  541. let dialog_a_id = Note_Obj.fn.getUserIdFromLink(dialog_a.href);
  542. note_obj.judgeUsers(dialog_a_id) &&
  543. note_obj.handler(dialog_a_id, dialog_a, null, {
  544. title: true,
  545. classname: 'note-obj-ins-font-blue-color',
  546. });
  547. dialog.querySelector(selector.homepage.icon) &&
  548. dialog
  549. .querySelector(selector.homepage.icon)
  550. .insertAdjacentElement(
  551. 'beforebegin',
  552. note_obj.createNoteBtn(dialog_a_id, null, ['note-obj-ins-add-btn', 'note-obj-ins-homepage-btn'], 'span')
  553. );
  554. }
  555. for (let like of dialog.querySelectorAll(selector.homepage.comment_id)) {
  556. let like_id = Note_Obj.fn.getUserIdFromLink(like.href);
  557. note_obj.judgeUsers(like_id) &&
  558. note_obj.handler(like_id, like, null, {
  559. classname: 'note-obj-ins-font-blue-color',
  560. });
  561. }
  562. dialog.arrive(selector.dialog.comment_id, arrive_option, comment_user => {
  563. let comment_id = Note_Obj.fn.getUserIdFromLink(comment_user.href);
  564. note_obj.judgeUsers(comment_id) &&
  565. note_obj.handler(comment_id, comment_user, null, {
  566. classname: 'note-obj-ins-font-blue-color',
  567. title: true,
  568. });
  569. });
  570. dialog.arrive(selector.dialog.comment_at, arrive_option, comment_at => {
  571. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  572. note_obj.judgeUsers(comment_at_id) &&
  573. note_obj.handler(comment_at_id, comment_at, null, {
  574. symbol: {
  575. prefix: '@',
  576. },
  577. classname: 'note-obj-ins-font-blue-color',
  578. title: true,
  579. });
  580. });
  581. });
  582. document.body.arrive(selector.request.follow, arrive_option, follow => {
  583. let follow_user_id = Note_Obj.fn.getUserIdFromLink(follow.href);
  584. note_obj.judgeUsers(follow_user_id) &&
  585. note_obj.handler(follow_user_id, follow, null, {
  586. classname: 'note-obj-ins-font-blue-color',
  587. });
  588. });
  589. document.body.arrive(selector.suggest.user, arrive_option, suggest_user => {
  590. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest_user.href);
  591. note_obj.judgeUsers(suggest_user_id) &&
  592. note_obj.handler(suggest_user_id, suggest_user, null, {
  593. classname: 'note-obj-ins-font-blue-color',
  594. });
  595. });
  596. document.body.arrive(selector.user_page.suggest, arrive_option, suggest => {
  597. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest.href);
  598. note_obj.judgeUsers(suggest_user_id) &&
  599. note_obj.handler(suggest_user_id, suggest, null, {
  600. classname: 'note-obj-ins-font-blue-color',
  601. });
  602. });
  603. }
  604. let note_obj = new Note_Obj('myInstagramNote');
  605. await note_obj.init({
  606. style: INS_STYLE,
  607. changeEvent: instagram_Change_Event,
  608. script: {
  609. author: {
  610. name: 'pana',
  611. homepage: 'https://greasyfork.org/zh-CN/users/193133-pana',
  612. },
  613. address: 'https://greasyfork.org/scripts/387871',
  614. updated: updated,
  615. library: [
  616. {
  617. name: 'arrive.js',
  618. version: '2.4.1',
  619. url: 'https://github.com/uzairfarooq/arrive',
  620. },
  621. ],
  622. },
  623. primaryColor: '#336699',
  624. settings: {
  625. replaceHomepageID: {
  626. type: 'checkbox',
  627. lang: {
  628. en: 'Allow to replace the user ID on the instagram homepage',
  629. zh_cn: '允许替换 Instagram 首页上的用户 ID',
  630. zh_tw: '允許替換 Instagram 首頁上的用戶 ID',
  631. ja: 'Instagram ホームページのユーザーIDの置き換えを許可する',
  632. ko: 'Instagram 첫 페이지에 있는 사용자 ID 바꾸기 허용',
  633. fr: "Permettre de remplacer l'ID utilisateur sur la page d'accueil Instagram",
  634. },
  635. default: true,
  636. event: instagram_Homepage_Event,
  637. },
  638. },
  639. });
  640. init_Instagram(note_obj);
  641. })();