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

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

当前为 2020-09-14 提交的版本,查看 最新版本

  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://www.sailboatweb.com
  11. // @icon data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9Im5ld0ljb25UaXRsZSIgc3Ryb2tlPSJyZ2JhKDI5LDE2MSwyNDIsMS4wMCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYmEoMjksMTYxLDI0MiwxLjAwKSI+IDx0aXRsZSBpZD0ibmV3SWNvblRpdGxlIj5OZXc8L3RpdGxlPiA8cGF0aCBkPSJNMTkgMTRWMjJIMi45OTk5N1Y0SDEzIi8+IDxwYXRoIGQ9Ik0xNy40NjA4IDQuMDM5MjFDMTguMjQxOCAzLjI1ODE3IDE5LjUwODIgMy4yNTgxNiAyMC4yODkyIDQuMDM5MjFMMjAuOTYwOCA0LjcxMDc5QzIxLjc0MTggNS40OTE4NCAyMS43NDE4IDYuNzU4MTcgMjAuOTYwOCA3LjUzOTIxTDExLjU4NTggMTYuOTE0MkMxMS4yMTA3IDE3LjI4OTMgMTAuNzAyIDE3LjUgMTAuMTcxNiAxNy41TDcuNSAxNy41TDcuNSAxNC44Mjg0QzcuNSAxNC4yOTggNy43MTA3MSAxMy43ODkzIDguMDg1NzkgMTMuNDE0MkwxNy40NjA4IDQuMDM5MjFaIi8+IDxwYXRoIGQ9Ik0xNi4yNSA1LjI1TDE5Ljc1IDguNzUiLz4gPC9zdmc+
  12. // @version 5.1.2
  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. // @include http*://*veryins.com/*
  26. // @include http*://*inswanghong.xyz/*
  27. // @include http*://*ins89.com/*
  28. // @require https://cdn.jsdelivr.net/npm/arrive@2.4.1/minified/arrive.min.js
  29. // @require https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js
  30. // @require https://greasyfork.org/scripts/408454-note-obj/code/Note_Obj.js?version=847799
  31. // @grant GM_info
  32. // @grant GM.info
  33. // @grant GM_getValue
  34. // @grant GM.getValue
  35. // @grant GM_setValue
  36. // @grant GM.setValue
  37. // @grant GM_deleteValue
  38. // @grant GM.deleteValue
  39. // @grant GM_listValues
  40. // @grant GM.listValues
  41. // @grant GM_openInTab
  42. // @grant GM.openInTab
  43. // @grant GM_registerMenuCommand
  44. // @grant GM_unregisterMenuCommand
  45. // @grant GM_addValueChangeListener
  46. // @grant GM_removeValueChangeListener
  47. // ==/UserScript==
  48.  
  49. (async function() {
  50. 'use strict';
  51. const INS_ICON = {
  52. 'NOTE_BLACK': 'url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9Im5ld0ljb25UaXRsZSIgc3Ryb2tlPSJyZ2IoMzgsIDM4LCAzOCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYigzOCwgMzgsIDM4KSI+IDx0aXRsZSBpZD0ibmV3SWNvblRpdGxlIj5OZXc8L3RpdGxlPiA8cGF0aCBkPSJNMTkgMTRWMjJIMi45OTk5N1Y0SDEzIi8+IDxwYXRoIGQ9Ik0xNy40NjA4IDQuMDM5MjFDMTguMjQxOCAzLjI1ODE3IDE5LjUwODIgMy4yNTgxNiAyMC4yODkyIDQuMDM5MjFMMjAuOTYwOCA0LjcxMDc5QzIxLjc0MTggNS40OTE4NCAyMS43NDE4IDYuNzU4MTcgMjAuOTYwOCA3LjUzOTIxTDExLjU4NTggMTYuOTE0MkMxMS4yMTA3IDE3LjI4OTMgMTAuNzAyIDE3LjUgMTAuMTcxNiAxNy41TDcuNSAxNy41TDcuNSAxNC44Mjg0QzcuNSAxNC4yOTggNy43MTA3MSAxMy43ODkzIDguMDg1NzkgMTMuNDE0MkwxNy40NjA4IDQuMDM5MjFaIi8+IDxwYXRoIGQ9Ik0xNi4yNSA1LjI1TDE5Ljc1IDguNzUiLz4gPC9zdmc+)',
  53. 'SERACH_BLUE': 'url(data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiBhcmlhLWxhYmVsbGVkYnk9InNlYXJjaEljb25UaXRsZSIgc3Ryb2tlPSJyZ2JhKDI5LDE2MSwyNDIsMS4wMCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbD0ibm9uZSIgY29sb3I9InJnYmEoMjksMTYxLDI0MiwxLjAwKSI+IDx0aXRsZSBpZD0ic2VhcmNoSWNvblRpdGxlIj5TZWFyY2g8L3RpdGxlPiA8cGF0aCBkPSJNMTQuNDEyMTEyMiwxNC40MTIxMTIyIEwyMCwyMCIvPiA8Y2lyY2xlIGN4PSIxMCIgY3k9IjEwIiByPSI2Ii8+IDwvc3ZnPg==)'
  54. };
  55. const INS_STYLE = `
  56. .note-obj-ins-font-blue-color {
  57. color: #336699;
  58. }
  59. .note-obj-ins-add-btn {
  60. background-image: ${INS_ICON.NOTE_BLACK};
  61. background-size: 24px;
  62. background-repeat: no-repeat;
  63. background-position: center;
  64. margin-left: 5px;
  65. cursor: pointer;
  66. width: 24px;
  67. height: 24px;
  68. }
  69. .note-obj-ins-homepage-btn {
  70. margin-top: 8px;
  71. }
  72. .note-obj-ins-userpage-btn {
  73. margin-top: 2px;
  74. }
  75. .note-obj-ins-userpage-tag {
  76. display: block;
  77. font-size: 20px;
  78. margin-bottom: 20px;
  79. white-space: nowrap;
  80. }
  81. .note-obj-ins-mobile-search-button {
  82. background-image: ${INS_ICON.SERACH_BLUE};
  83. background-size: 24px;
  84. background-repeat: no-repeat;
  85. background-position: center;
  86. cursor: pointer;
  87. min-width: 0px;
  88. height: 100%;
  89. flex: 1 1 auto;
  90. }
  91. .note-obj-ins-font-bold {
  92. font-weight: bold;
  93. }
  94. .note-obj-veryins-blue-tag {
  95. background-color: #3c81df;
  96. color: #fff;
  97. display: inline-flex;
  98. align-items: center;
  99. padding: 0px 10px;
  100. white-space: nowrap;
  101. line-height: 100%;
  102. border-radius: 50px;
  103. padding: 2px 10px;
  104. }
  105. .note-obj-veryins-userpage-btn {
  106. display: inline-block;
  107. vertical-align: middle;
  108. }
  109. `;
  110. var selector = {
  111. 'body': 'body',
  112. 'root': '#react-root',
  113. 'search': {
  114. 'frame': '.LWmhU'
  115. },
  116. 'homepage': {
  117. 'article': 'article',
  118. 'id': '.e1e1d a',
  119. 'id_shell': '.e1e1d',
  120. 'icon': 'span.wmtNn',
  121. 'comment_id': '.FPmhX',
  122. 'comment_at': '._8Pl3R .notranslate'
  123. },
  124. 'homepage_stories': {
  125. 'id': '.eebAO',
  126. 'id_shell': '.Fd_fQ',
  127. },
  128. 'homepage_recommend': {
  129. 'id': '.fDxYl a'
  130. },
  131. 'user_page': {
  132. 'frame': '.zwlfE',
  133. 'id': '.KV-D4',
  134. 'bar': '.AFWDX',
  135. 'box': '.nZSzR',
  136. 'common': 'span._32eiM',
  137. 'suggest': '.Qj3-a',
  138. 'info_at': '.notranslate',
  139. 'user_name': '.-vDIg .rhpdm'
  140. },
  141. 'stories': {
  142. 'id': '.FPmhX',
  143. 'id_shell': '.yn6BW'
  144. },
  145. 'watch_list': {
  146. 'initial_item': '.isgrP li',
  147. 'later_item': '.d7ByH',
  148. 'id': 'a.FPmhX'
  149. },
  150. 'dialog': {
  151. 'frame': '._2dDPU article',
  152. 'comment_id': '.EtaWk .ZIAjV',
  153. 'comment_at': '.EtaWk .notranslate'
  154. },
  155. 'request': {
  156. 'follow': '.yrJyr'
  157. },
  158. 'mobile': {
  159. 'bottom_bar': '.BvyAW'
  160. },
  161. 'suggest': {
  162. 'user': '.FPmhX.notranslate.MBL3Z'
  163. }
  164. };
  165. function instagram_Change_Event(note_obj, user_id = null) {
  166. for (let article of document.querySelectorAll(selector.homepage.article)) {
  167. let article_user = article.querySelector(selector.homepage.id);
  168. if (article_user) {
  169. let article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);
  170. (! user_id || user_id == article_user_id) && note_obj.handler(article_user_id, article_user, null, {
  171. 'classname': 'note-obj-ins-font-blue-color',
  172. 'title': true
  173. });
  174. }
  175. for (let comment of article.querySelectorAll(selector.homepage.comment_id)) {
  176. let comment_id = Note_Obj.fn.getUserIdFromLink(comment.href);
  177. (! user_id || user_id == comment_id) && note_obj.handler(comment_id, comment, null, {
  178. 'classname': 'note-obj-ins-font-blue-color'
  179. });
  180. }
  181. for (let comment_at of article.querySelectorAll(selector.homepage.comment_at)) {
  182. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  183. (! user_id || user_id == comment_at_id) && note_obj.handler(comment_at_id, comment_at, null, {
  184. 'symbol': {
  185. 'prefix': '@'
  186. },
  187. 'title': true,
  188. 'classname': 'note-obj-ins-font-blue-color'
  189. });
  190. }
  191. for (let pic_comment_user of (article.querySelectorAll(selector.dialog.comment_id))) {
  192. let pic_comment_id = Note_Obj.fn.getUserIdFromLink(pic_comment_user.href);
  193. (! user_id || user_id == pic_comment_id) && note_obj.handler(pic_comment_id, pic_comment_user, null, {
  194. 'title': true,
  195. 'classname': 'note-obj-ins-font-blue-color'
  196. });
  197. }
  198. for (let pic_comment_at of article.querySelectorAll(selector.dialog.comment_at)) {
  199. if (! pic_comment_at.classList.contains(selector.homepage.comment_id.replace(/^\.|\s+.*$/g, ''))) {
  200. let pic_comment_at_id = Note_Obj.fn.getUserIdFromLink(pic_comment_at.href);
  201. (! user_id || user_id == pic_comment_at_id) && note_obj.handler(pic_comment_at_id, pic_comment_at, null, {
  202. 'symbol': {
  203. 'prefix': '@'
  204. },
  205. 'title': true,
  206. 'classname': 'note-obj-ins-font-blue-color'
  207. });
  208. }
  209. }
  210. }
  211. for (let homepage_stories of document.querySelectorAll(selector.homepage_stories.id_shell)) {
  212. if (homepage_stories.querySelector(selector.homepage_stories.id)) {
  213. let homepage_stories_id = homepage_stories.querySelector(selector.homepage_stories.id).textContent;
  214. if (! user_id || user_id == homepage_stories_id) {
  215. homepage_stories.title = note_obj.getUserTag(homepage_stories_id);
  216. }
  217. }
  218. }
  219. for (let homepage_recommend of document.querySelectorAll(selector.homepage_recommend.id)) {
  220. let homepage_recommend_id = note_obj.getUserIdFromLink(homepage_recommend.href);
  221. (! user_id || user_id == homepage_recommend_id) && note_obj.handler(homepage_recommend_id, homepage_recommend, null, {
  222. 'classname': 'note-obj-ins-font-blue-color'
  223. });
  224. }
  225. for (let user_page of document.querySelectorAll(selector.user_page.frame)) {
  226. if (user_page.querySelector(selector.user_page.id)) {
  227. let user_page_id = user_page.querySelector(selector.user_page.id).textContent;
  228. if (! user_id || user_id == user_page_id) {
  229. let user_page_tag = user_page.querySelector('.note-obj-user-tag');
  230. user_page_tag && user_page_tag.remove();
  231. note_obj.judgeUsers(user_page_id) && user_page.querySelector(selector.user_page.box).after(note_obj.createNoteTag(user_page_id, {
  232. 'secondaryColor': false,
  233. 'offsetWidth': -20
  234. }, 'div', ['note-obj-ins-userpage-tag', 'note-obj-ins-font-blue-color', 'note-obj-ins-font-bold']));
  235. }
  236. }
  237. for (let common_user of user_page.querySelectorAll(selector.user_page.common)) {
  238. let common_user_id = common_user.textContent;
  239. if (! user_id || user_id == common_user_id) {
  240. if (note_obj.judgeUsers(common_user_id)) {
  241. common_user.title = note_obj.getUserTag(common_user_id);
  242. if (note_obj.getShowNoteColorConfig()) {
  243. common_user.style.setProperty('color', note_obj.getPrimaryColor(common_user_id), 'important');
  244. } else {
  245. common_user.style.setProperty('color', '');
  246. }
  247. common_user.classList.add('note-obj-ins-font-blue-color');
  248. } else {
  249. common_user.title = '',
  250. common_user.style.setProperty('color', '');
  251. common_user.classList.remove('note-obj-ins-font-blue-color');
  252. }
  253. }
  254. }
  255. for (let info_at_user of user_page.querySelectorAll(selector.user_page.info_at)) {
  256. let info_at_user_id = Note_Obj.fn.getUserIdFromLink(info_at_user.href);
  257. (! user_id || user_id == info_at_user_id) && note_obj.handler(info_at_user_id, info_at_user, null, {
  258. 'symbol': {
  259. 'prefix': '@'
  260. },
  261. 'classname': 'note-obj-ins-font-blue-color',
  262. 'title': true
  263. });
  264. }
  265. }
  266. for (let stories_shell of document.querySelectorAll(selector.stories.id_shell)) {
  267. let stories = stories_shell.querySelector(selector.stories.id);
  268. if (stories) {
  269. let stories_user_id = Note_Obj.fn.getUserIdFromLink(stories.href);
  270. (! user_id || user_id == stories_user_id) && note_obj.handler(stories_user_id, stories, null, {
  271. 'classname': 'note-obj-ins-font-blue-color'
  272. });
  273. }
  274. }
  275. for (let initial of document.querySelectorAll(selector.watch_list.initial_item)) {
  276. let initial_item = initial.querySelector(selector.watch_list.id);
  277. if (initial_item) {
  278. let initial_item_id = Note_Obj.fn.getUserIdFromLink(initial_item.href);
  279. (! user_id || user_id == initial_item_id) && note_obj.handler(initial_item_id, initial_item, null, {
  280. 'classname': 'note-obj-ins-font-blue-color'
  281. });
  282. }
  283. }
  284. for (let later of document.querySelectorAll(selector.watch_list.later_item)) {
  285. let later_item = later.querySelector(selector.watch_list.id);
  286. if (later_item) {
  287. let later_item_id = Note_Obj.fn.getUserIdFromLink(later_item.href);
  288. (! user_id || user_id == later_item_id) && note_obj.handler(later_item_id, later_item, null, {
  289. 'classname': 'note-obj-ins-font-blue-color'
  290. });
  291. }
  292. }
  293. for (let dialog of document.querySelectorAll(selector.dialog.frame)) {
  294. let dialog_a = dialog.querySelector(selector.homepage.id);
  295. if (dialog_a) {
  296. let dialog_a_id = Note_Obj.fn.getUserIdFromLink(dialog_a.href);
  297. (! user_id || user_id == dialog_a_id) && note_obj.handler(dialog_a_id, dialog_a, null, {
  298. 'title': true,
  299. 'classname': 'note-obj-ins-font-blue-color'
  300. });
  301. }
  302. for (let like of dialog.querySelectorAll(selector.homepage.comment_id)) {
  303. let like_id = Note_Obj.fn.getUserIdFromLink(like.href);
  304. (! user_id || user_id == like_id) && note_obj.judgeUsers(like_id) && note_obj.handler(like_id, like, null, {
  305. 'classname': 'note-obj-ins-font-blue-color'
  306. });
  307. }
  308. for (let comment_user of dialog.querySelectorAll(selector.dialog.comment_id)) {
  309. let comment_id = Note_Obj.fn.getUserIdFromLink(comment_user.href);
  310. (! user_id || user_id == comment_id) && note_obj.handler(comment_id, comment_user, null, {
  311. 'classname': 'note-obj-ins-font-blue-color',
  312. 'title': true
  313. });
  314. }
  315. for (let comment_at of dialog.querySelectorAll(selector.dialog.comment_at)) {
  316. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  317. (! user_id || user_id == comment_at_id) && note_obj.handler(comment_at_id, comment_at, null, {
  318. 'symbol': {
  319. 'prefix': '@'
  320. },
  321. 'classname': 'note-obj-ins-font-blue-color',
  322. 'title': true
  323. });
  324. }
  325. }
  326. for (let follow of document.querySelectorAll(selector.request.follow)) {
  327. let follow_user_id = Note_Obj.fn.getUserIdFromLink(follow.href);
  328. (! user_id || user_id == follow_user_id) && note_obj.handler(follow_user_id, follow, null, {
  329. 'classname': 'note-obj-ins-font-blue-color'
  330. });
  331. }
  332. for (let suggest_user of document.querySelectorAll(selector.suggest.user)) {
  333. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest_user.href);
  334. (! user_id || user_id == suggest_user_id) && note_obj.handler(suggest_user_id, suggest_user, null, {
  335. 'classname': 'note-obj-ins-font-blue-color'
  336. });
  337. }
  338. for (let suggest of document.querySelectorAll(selector.user_page.suggest)) {
  339. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest.href);
  340. (! user_id || user_id == suggest_user_id) && note_obj.handler(suggest_user_id, suggest, null, {
  341. 'classname': 'note-obj-ins-font-blue-color'
  342. });
  343. }
  344. }
  345. function veryins_Change_Event(note_obj, id = null) {
  346. document.querySelectorAll('#list .item').forEach(item => {
  347. let user = item.querySelector('.item-body > div > a');
  348. if (user) {
  349. let user_id = Note_Obj.fn.getUserIdFromLink(user.href);
  350. (! id || id == user_id) && note_obj.handler(user_id, user, null, {
  351. 'add': 'span',
  352. 'classname': 'note-obj-veryins-blue-tag'
  353. });
  354. }
  355. });
  356. document.querySelectorAll('.row.header').forEach(item => {
  357. let user = item.querySelector('section > div > div');
  358. if (user) {
  359. let user_id = user.querySelector('#username') && user.querySelector('#username').textContent;
  360. (! id || id == user_id) && user.querySelector('div > strong') && note_obj.handler(user_id, user.querySelector('div > strong'), null, {
  361. 'add': 'span',
  362. 'classname': 'note-obj-veryins-blue-tag'
  363. });
  364. }
  365. });
  366. document.querySelectorAll('.img-container .article .caption-header a').forEach(item => {
  367. let user_id = Note_Obj.fn.getUserIdFromLink(item.href, value => /^[^/]+$/i.test(value));
  368. (!id || id == user_id) && note_obj.handler(user_id, item, null, {
  369. 'add': 'span',
  370. 'classname': 'note-obj-veryins-blue-tag'
  371. });
  372. });
  373. }
  374. function inswanghong_Change_Event(note_obj, id = null) {
  375. document.querySelectorAll('#tiles .info').forEach(item => {
  376. let user_id = item.title || item.textContent;
  377. (! id || id == user_id) && note_obj.handler(user_id, item, null, {
  378. 'title': true,
  379. 'classname': 'note-obj-ins-font-blue-color'
  380. });
  381. });
  382. }
  383. function ins89_Change_Event(note_obj, id = null) {
  384. document.querySelectorAll('.container .row.pt-2 .card').forEach(item => {
  385. let card_header_user = item.querySelector('.card-header .username');
  386. if (card_header_user) {
  387. let card_header_user_id = Note_Obj.fn.getUserIdFromLink(card_header_user.href);
  388. (! id || id == card_header_user_id) && note_obj.handler(card_header_user_id, card_header_user, null, {
  389. 'title': true
  390. });
  391. let card_body_user = item.querySelector('.card-body .username');
  392. if (card_body_user) {
  393. (! id || id == card_header_user_id) && note_obj.handler(card_header_user_id, card_body_user, null, {
  394. 'title': true
  395. });
  396. }
  397. }
  398. });
  399. document.querySelectorAll('.profile-info-pannel .container').forEach(item => {
  400. let profile_avatar = item.querySelector('.profile-avatar a');
  401. if (profile_avatar) {
  402. let user_id = Note_Obj.fn.getUserIdFromLink(profile_avatar.href);
  403. if (! id || id == user_id) {
  404. let username_bar = item.querySelector('.username-bar h1');
  405. username_bar && note_obj.handler(user_id, username_bar, null, {
  406. 'title': true
  407. });
  408. }
  409. }
  410. });
  411. document.querySelectorAll('.postComponent .card .status-username .username .username-link').forEach(item => {
  412. let user_id = item.textContent;
  413. (! id || id == user_id) && note_obj.handler(user_id, item, null);
  414. });
  415. document.querySelectorAll('.modal-content .blogger-list .concern .concern-box').forEach(item => {
  416. let user_a = item.querySelector('a');
  417. if (user_a) {
  418. let user_id = Note_Obj.fn.getUserIdFromLink(user_a.href);
  419. let concern_text = item.querySelector('.concern-text .text-name');
  420. concern_text && (! id || id == user_id) && note_obj.handler(user_id, concern_text, null);
  421. }
  422. });
  423. }
  424. function init_Instagram(note_obj) {
  425. let arrive_option = {
  426. 'fireOnAttributesModification': true,
  427. 'existing': true
  428. };
  429. Note_Obj.fn.isMobilePage() && document.querySelector(selector.root).arrive(selector.mobile.bottom_bar, arrive_option, item => item.appendChild(note_obj.createSearchButton('note-obj-ins-mobile-search-button')));
  430. document.querySelector(selector.root).arrive(selector.homepage.article, arrive_option, article => {
  431. let article_user = article.querySelector(selector.homepage.id);
  432. if (article_user) {
  433. let article_user_id = Note_Obj.fn.getUserIdFromLink(article_user.href);
  434. note_obj.judgeUsers(article_user_id) && note_obj.handler(article_user_id, article_user, null, {
  435. 'classname': 'note-obj-ins-font-blue-color',
  436. 'title': true
  437. });
  438. 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']));
  439. }
  440. for (let comment of article.querySelectorAll(selector.homepage.comment_id)) {
  441. let comment_id = Note_Obj.fn.getUserIdFromLink(comment.href);
  442. note_obj.judgeUsers(comment_id) && note_obj.handler(comment_id, comment, null, {
  443. 'classname': 'note-obj-ins-font-blue-color'
  444. });
  445. }
  446. article.arrive(selector.homepage.comment_at, arrive_option, comment_at => {
  447. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  448. note_obj.judgeUsers(comment_at_id) && note_obj.handler(comment_at_id, comment_at, null, {
  449. 'symbol': {
  450. 'prefix': '@'
  451. },
  452. 'title': true,
  453. 'classname': 'note-obj-ins-font-blue-color'
  454. });
  455. });
  456. article.arrive(selector.dialog.comment_id, arrive_option, pic_comment_user => {
  457. let pic_comment_id = Note_Obj.fn.getUserIdFromLink(pic_comment_user.href);
  458. note_obj.judgeUsers(pic_comment_id) && note_obj.handler(pic_comment_id, pic_comment_user, null, {
  459. 'title': true,
  460. 'classname': 'note-obj-ins-font-blue-color'
  461. });
  462. });
  463. article.arrive(selector.dialog.comment_at, arrive_option, pic_comment_at => {
  464. if (! pic_comment_at.classList.contains(selector.homepage.comment_id.replace(/^\.|\s+.*$/g, ''))) {
  465. let pic_comment_at_id = Note_Obj.fn.getUserIdFromLink(pic_comment_at.href);
  466. note_obj.judgeUsers(pic_comment_at_id) && note_obj.handler(pic_comment_at_id, pic_comment_at, null, {
  467. 'symbol': {
  468. 'prefix': '@'
  469. },
  470. 'title': true,
  471. 'classname': 'note-obj-ins-font-blue-color'
  472. });
  473. }
  474. });
  475. });
  476. document.querySelector(selector.root).arrive(selector.homepage_stories.id_shell, arrive_option, homepage_stories => {
  477. if (homepage_stories.querySelector(selector.homepage_stories.id)) {
  478. let homepage_stories_id = homepage_stories.querySelector(selector.homepage_stories.id).textContent;
  479. if (note_obj.judgeUsers(homepage_stories_id)) {
  480. homepage_stories.title = note_obj.getUserTag(homepage_stories_id);
  481. }
  482. }
  483. });
  484. document.querySelector(selector.root).arrive(selector.homepage_recommend.id, arrive_option, homepage_recommend => {
  485. let homepage_recommend_id = note_obj.getUserIdFromLink(homepage_recommend.href);
  486. note_obj.judgeUsers(homepage_recommend_id) && note_obj.handler(homepage_recommend_id, homepage_recommend, null, {
  487. 'classname': 'note-obj-ins-font-blue-color'
  488. });
  489. });
  490. document.querySelector(selector.root).arrive(selector.user_page.frame, arrive_option, user_page => {
  491. if (user_page.querySelector(selector.user_page.id)) {
  492. let user_page_id = user_page.querySelector(selector.user_page.id).textContent;
  493. let user_name = user_page.querySelector(selector.user_page.user_name);
  494. let user_name_text = '';
  495. if (user_name) {
  496. user_name_text = user_page.querySelector(selector.user_page.user_name).textContent;
  497. }
  498. 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']));
  499. note_obj.judgeUsers(user_page_id) && user_page.querySelector(selector.user_page.box).after(note_obj.createNoteTag(user_page_id, {
  500. 'secondaryColor': false,
  501. 'offsetWidth': -20
  502. }, 'div', ['note-obj-ins-userpage-tag', 'note-obj-ins-font-blue-color', 'note-obj-ins-font-bold'], user_name_text));
  503. }
  504. for (let common_user of user_page.querySelectorAll(selector.user_page.common)) {
  505. let common_user_id = common_user.textContent;
  506. if (note_obj.judgeUsers(common_user_id)) {
  507. common_user.title = note_obj.getUserTag(common_user_id);
  508. note_obj.getShowNoteColorConfig() && common_user.style.setProperty('color', note_obj.getPrimaryColor(common_user_id), 'important');
  509. common_user.classList.add('note-obj-ins-font-blue-color');
  510. }
  511. }
  512. for (let info_at_user of user_page.querySelectorAll(selector.user_page.info_at)) {
  513. let info_at_user_id = Note_Obj.fn.getUserIdFromLink(info_at_user.href);
  514. note_obj.judgeUsers(info_at_user_id) && note_obj.handler(info_at_user_id, info_at_user, null, {
  515. 'symbol': {
  516. 'prefix': '@'
  517. },
  518. 'classname': 'note-obj-ins-font-blue-color',
  519. 'title': true
  520. });
  521. }
  522. });
  523. document.querySelector(selector.root).arrive(selector.stories.id_shell, arrive_option, stories_shell => {
  524. let stories = stories_shell.querySelector(selector.stories.id);
  525. if (stories) {
  526. let stories_user_id = Note_Obj.fn.getUserIdFromLink(stories.href);
  527. note_obj.judgeUsers(stories_user_id) && note_obj.handler(stories_user_id, stories, null, {
  528. 'classname': 'note-obj-ins-font-blue-color'
  529. });
  530. }
  531. });
  532. document.querySelector(selector.body).arrive(selector.watch_list.initial_item, arrive_option, initial => {
  533. let initial_item = initial.querySelector(selector.watch_list.id);
  534. if (initial_item) {
  535. let initial_item_id = Note_Obj.fn.getUserIdFromLink(initial_item.href);
  536. note_obj.judgeUsers(initial_item_id) && note_obj.handler(initial_item_id, initial_item, null, {
  537. 'classname': 'note-obj-ins-font-blue-color'
  538. });
  539. }
  540. });
  541. document.querySelector(selector.body).arrive(selector.watch_list.later_item, arrive_option, later => {
  542. let later_item = later.querySelector(selector.watch_list.id);
  543. if (later_item) {
  544. let later_item_id = Note_Obj.fn.getUserIdFromLink(later_item.href);
  545. note_obj.judgeUsers(later_item_id) && note_obj.handler(later_item_id, later_item, null, {
  546. 'classname': 'note-obj-ins-font-blue-color'
  547. });
  548. }
  549. });
  550. document.querySelector(selector.body).arrive(selector.dialog.frame, arrive_option, dialog => {
  551. let dialog_a = dialog.querySelector(selector.homepage.id);
  552. if (dialog_a) {
  553. let dialog_a_id = Note_Obj.fn.getUserIdFromLink(dialog_a.href);
  554. note_obj.judgeUsers(dialog_a_id) && note_obj.handler(dialog_a_id, dialog_a, null, {
  555. 'title': true,
  556. 'classname': 'note-obj-ins-font-blue-color'
  557. });
  558. 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']));
  559. }
  560. for (let like of dialog.querySelectorAll(selector.homepage.comment_id)) {
  561. let like_id = Note_Obj.fn.getUserIdFromLink(like.href);
  562. note_obj.judgeUsers(like_id) && note_obj.handler(like_id, like, null, {
  563. 'classname': 'note-obj-ins-font-blue-color'
  564. });
  565. }
  566. dialog.arrive(selector.dialog.comment_id, arrive_option, comment_user => {
  567. let comment_id = Note_Obj.fn.getUserIdFromLink(comment_user.href);
  568. note_obj.judgeUsers(comment_id) && note_obj.handler(comment_id, comment_user, null, {
  569. 'classname': 'note-obj-ins-font-blue-color',
  570. 'title': true
  571. });
  572. });
  573. dialog.arrive(selector.dialog.comment_at, arrive_option, comment_at => {
  574. let comment_at_id = Note_Obj.fn.getUserIdFromLink(comment_at.href);
  575. note_obj.judgeUsers(comment_at_id) && note_obj.handler(comment_at_id, comment_at, null, {
  576. 'symbol': {
  577. 'prefix': '@'
  578. },
  579. 'classname': 'note-obj-ins-font-blue-color',
  580. 'title': true
  581. });
  582. });
  583. });
  584. document.querySelector(selector.root).arrive(selector.request.follow, arrive_option, follow => {
  585. let follow_user_id = Note_Obj.fn.getUserIdFromLink(follow.href);
  586. note_obj.judgeUsers(follow_user_id) && note_obj.handler(follow_user_id, follow, null, {
  587. 'classname': 'note-obj-ins-font-blue-color'
  588. });
  589. });
  590. document.querySelector(selector.root).arrive(selector.suggest.user, arrive_option, suggest_user => {
  591. let suggest_user_id = Note_Obj.fn.getUserIdFromLink(suggest_user.href);
  592. note_obj.judgeUsers(suggest_user_id) && note_obj.handler(suggest_user_id, suggest_user, null, {
  593. 'classname': 'note-obj-ins-font-blue-color'
  594. });
  595. });
  596. document.querySelector(selector.root).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) && note_obj.handler(suggest_user_id, suggest, null, {
  599. 'classname': 'note-obj-ins-font-blue-color'
  600. });
  601. });
  602. }
  603. function init_Veryins(note_obj) {
  604. let arrive_option = {
  605. 'fireOnAttributesModification': true,
  606. 'existing': true
  607. };
  608. document.getElementById('list') && document.getElementById('list').arrive('.item', arrive_option, item => {
  609. let user = item.querySelector('.item-body > div > a');
  610. if (user) {
  611. let user_id = Note_Obj.fn.getUserIdFromLink(user.href);
  612. note_obj.judgeUsers(user_id) && note_obj.handler(user_id, user, null, {
  613. 'add': 'span',
  614. 'classname': 'note-obj-veryins-blue-tag'
  615. }, user.textContent);
  616. }
  617. });
  618. document.querySelectorAll('.row.header').forEach(item => {
  619. let user = item.querySelector('section > div > div');
  620. if (user) {
  621. let user_id = user.querySelector('#username') && user.querySelector('#username').textContent;
  622. let user_name = user.querySelector('#username') && user.querySelector('#username').dataset.fullname;
  623. user.querySelector('div > strong') && note_obj.judgeUsers(user_id) && note_obj.handler(user_id, user.querySelector('div > strong'), null, {
  624. 'add': 'span',
  625. 'classname': 'note-obj-veryins-blue-tag'
  626. }, user_name);
  627. user.querySelector('#similar') && user.querySelector('#similar').after(note_obj.createNoteBtn(user_id, user_name, ['note-obj-ins-add-btn', 'note-obj-veryins-userpage-btn']));
  628. }
  629. });
  630. document.querySelector('.img-container .article .caption-header') && document.querySelector('.img-container .article .caption-header').arrive('a', arrive_option, item => {
  631. let user_id = Note_Obj.fn.getUserIdFromLink(item.href, value => /^[^/]+$/i.test(value));
  632. note_obj.judgeUsers(user_id) && note_obj.handler(user_id, item, null, {
  633. 'add': 'span',
  634. 'classname': 'note-obj-veryins-blue-tag'
  635. }, item.textContent);
  636. });
  637. }
  638. function init_Inswanghong(note_obj) {
  639. document.querySelectorAll('#tiles .info').forEach(item => {
  640. let user_id = item.textContent;
  641. note_obj.judgeUsers(user_id) && note_obj.handler(user_id, item, null, {
  642. 'title': true,
  643. 'classname': 'note-obj-ins-font-blue-color'
  644. });
  645. });
  646. }
  647. function init_Ins89(note_obj) {
  648. let arrive_option = {
  649. 'fireOnAttributesModification': true,
  650. 'existing': true
  651. };
  652. document.querySelector('.container .row.pt-2') && document.querySelector('.container .row.pt-2').arrive('.card', arrive_option, item => {
  653. let card_header_user = item.querySelector('.card-header .username');
  654. if (card_header_user) {
  655. let card_header_user_id = Note_Obj.fn.getUserIdFromLink(card_header_user.href);
  656. note_obj.judgeUsers(card_header_user_id) && note_obj.handler(card_header_user_id, card_header_user, null, {
  657. 'title': true
  658. });
  659. let card_body_user = item.querySelector('.card-body .username');
  660. if (card_body_user) {
  661. note_obj.judgeUsers(card_header_user_id) && note_obj.handler(card_header_user_id, card_body_user, null, {
  662. 'title': true
  663. });
  664. }
  665. }
  666. });
  667. document.querySelectorAll('.profile-info-pannel .container').forEach(item => {
  668. let profile_avatar = item.querySelector('.profile-avatar a');
  669. if (profile_avatar) {
  670. let user_id = Note_Obj.fn.getUserIdFromLink(profile_avatar.href);
  671. if (note_obj.judgeUsers(user_id)) {
  672. let username_bar = item.querySelector('.username-bar h1');
  673. username_bar && note_obj.handler(user_id, username_bar, null, {
  674. 'title': true
  675. });
  676. }
  677. let fa_ellipsis_h = item.querySelector('.fa-ellipsis-h');
  678. fa_ellipsis_h && fa_ellipsis_h.after(note_obj.createNoteBtn(user_id, null, ['note-obj-ins-add-btn', 'note-obj-veryins-userpage-btn']));
  679. }
  680. });
  681. document.querySelectorAll('.postComponent .card .status-username .username .username-link').forEach(item => {
  682. let user_id = item.textContent;
  683. note_obj.judgeUsers(user_id) && note_obj.handler(user_id, item, null);
  684. });
  685. document.querySelector('.modal-content .blogger-list') && document.querySelector('.modal-content .blogger-list').arrive('.concern .concern-box', arrive_option, item => {
  686. let user_a = item.querySelector('a');
  687. if (user_a) {
  688. let user_id = Note_Obj.fn.getUserIdFromLink(user_a.href);
  689. let concern_text = item.querySelector('.concern-text .text-name');
  690. concern_text && note_obj.judgeUsers(user_id) && note_obj.handler(user_id, concern_text, null);
  691. }
  692. });
  693. }
  694. var cur_url = location.hostname;
  695. let note_obj = new Note_Obj('myInstagramNote');
  696. await note_obj.init({
  697. 'style': INS_STYLE,
  698. 'changeEvent': (cur_url.includes('instagram.com') && instagram_Change_Event) || (cur_url.includes('veryins.com') && veryins_Change_Event) || (cur_url.includes('inswanghong.xyz') && inswanghong_Change_Event) || (cur_url.includes('ins89.com') && ins89_Change_Event),
  699. 'script': {
  700. 'author': {
  701. 'name': 'pana',
  702. 'homepage': 'https://www.sailboatweb.com/'
  703. },
  704. 'address': 'https://greasyfork.org/scripts/387871',
  705. 'updated': '2020-9-14',
  706. 'library': [
  707. {
  708. 'name': 'arrive.js',
  709. 'version': '2.4.1',
  710. 'url': 'https://github.com/uzairfarooq/arrive'
  711. }
  712. ]
  713. },
  714. 'itemClick': cur_url.includes('inswanghong.xyz') ? (key => 'https://veryins.com/' + key) : null,
  715. 'primaryColor': '#336699'
  716. });
  717. if (cur_url.includes('instagram.com')) {
  718. init_Instagram(note_obj);
  719. } else if (cur_url.includes('veryins.com')) {
  720. init_Veryins(note_obj);
  721. } else if (cur_url.includes('inswanghong.xyz')) {
  722. init_Inswanghong(note_obj);
  723. } else if (cur_url.includes('ins89.com')) {
  724. init_Ins89(note_obj);
  725. }
  726. })();