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

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

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

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