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