Instagram - 为用户添加备注

为用户添加备注功能,以帮助识别和搜索

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

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