USO - Display additional infos & fixes

Display additional information. Total installs, update date, initial release date. Fix site's navigability.

当前为 2023-06-13 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name USO - Display additional infos & fixes
  3. // @namespace https://github.com/Procyon-b
  4. // @version 0.3.2
  5. // @description Display additional information. Total installs, update date, initial release date. Fix site's navigability.
  6. // @author Achernar
  7. // @match https://userstyles.org/*
  8. // @run-at document-start
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. "use strict";
  14.  
  15. var initial=true, firstPage=true;
  16.  
  17. // catch site errors
  18. if (location.pathname.startsWith('/styles/[styleId]/')) {
  19. let u=location.pathname.substr(17);
  20. history.replaceState({}, null, u);
  21. location.pathname=u;
  22. return;
  23. }
  24.  
  25.  
  26. // XHR -- XML
  27. self.XMLHttpRequest = class extends self.XMLHttpRequest {
  28. open(...args) {
  29. let t=this;
  30. // intercept and source code
  31. if ( arguments[1].startsWith('https://gateway.userstyles.org/styles/getStyleCss/') ) {
  32. styleLoaded=styleID || -1;
  33. loadCSS=1;
  34. this.addEventListener('load', function(){
  35. var id=t.responseURL.split('/').pop();
  36. if (styles[id] && !styles[id].sourceCode) styles[id].sourceCode=JP(t.response).result;
  37. });
  38. }
  39. return super.open(...args);
  40. }
  41. }
  42.  
  43. // JSON.parse
  44. var JP=JSON.parse;
  45. JSON.parse=function(){
  46. var r=JP(...arguments);
  47. getStyles(r);
  48. return r;
  49. }
  50.  
  51. // stop svg js animation
  52. window.requestAnimationFrame=function(){}
  53.  
  54. // handle data
  55. var stylesA=[], styles={};
  56. var total=0, styleLoaded;
  57. var closeBut;
  58.  
  59. function getStyles(o) {
  60. stylesA=parseObj(o, [], ['styles', 'stylesList', 'style']);
  61. stylesA.forEach((e) => {
  62. if (e.id && !styles[e.id]) {
  63. styles[e.id]=Object.assign({}, e);
  64. total++;
  65. }
  66. });
  67. }
  68.  
  69. function parseObj(o, A, n=[]) {
  70. var k, v;
  71. if ( (typeof o != 'object') || !Array.isArray(A)) return;
  72. for (k in o) {
  73. v=o[k];
  74. if ((typeof v == 'object') && n.includes(k)) A=A.concat(v);
  75. if (typeof v == 'object') A=parseObj(v, A, n);
  76. }
  77. return A;
  78. }
  79.  
  80. var done, newL, Tit, title, title0='Website Themes & Skins by Stylish | Userstyles.org',
  81. userID, cancelNextRS=0, dontCancel='', site='',
  82. bgPage='/', blockTitle;
  83.  
  84. if (document.readyState != 'loading') init('"already done"', 1);
  85. else {
  86. document.addEventListener('DOMContentLoaded', (ev) => { init('DOM');} );
  87. window.addEventListener('load', (ev) => { init('wLoad', 1);} );
  88. }
  89.  
  90.  
  91. function chkState(a) {
  92. var u=a[2];
  93. if (u == '/styles/browse') {
  94. if (bgPage.startsWith(u)) u=bgPage;
  95. }
  96. else if (u.startsWith('/styles/[styleId]/')) {
  97. title='';
  98. document.title=title0;
  99. u=bgPage;
  100. }
  101. else if (u.startsWith('/user-profile/[...userId]')) {
  102. if (userID || __NEXT_DATA__) {
  103. u='/user-profile/'+(userID || __NEXT_DATA__.query.userId);
  104. }
  105. }
  106. a[2]=u;
  107. }
  108.  
  109. // hide logo when scrolled. (saves cpu on old hardware)
  110. var Logo, LHidden=false;
  111. function hideLogo() {
  112. function toggle(set) {
  113. if ( Logo=(Logo && Logo.parentNode && Logo) || document.querySelector('[class^="welcome-banner_top_"] svg') )
  114. LHidden=Logo.classList.toggle('hideMe',set);
  115. else LHidden=set;
  116. }
  117. window.addEventListener('scroll', function() {
  118. if (window.scrollY > 200) {
  119. if (LHidden) return;
  120. toggle(true);
  121. }
  122. else if (LHidden) toggle(false);
  123. });
  124. }
  125.  
  126. var reactID;
  127.  
  128. function init(v, old) {
  129. if (done) return;
  130. newL=document.querySelector('#__next');
  131. if (!newL) {
  132. if (old && ST) ST.remove();
  133. return;
  134. }
  135. addSt();
  136. hideLogo();
  137. let t;
  138. done=true;
  139. reactID= (t=Object.keys(newL).find( (v) => v.startsWith('__react') )) && t.split('$')[1];
  140. if (__NEXT_DATA__.page == '/styles/[styleId]/[[...styleParams]]') bgPage='/';
  141. else if ( (__NEXT_DATA__.page == '/styles/browse/[[...categoryParams]]') || (__NEXT_DATA__.page == '/user-profile/[...userId]') )
  142. bgPage='/'+__NEXT_DATA__.props.metaTagsData.og.url.split('/').slice(3).join('/');
  143. let pushState=history.pushState;
  144. history.pushState=function(){
  145. let u=arguments[2];
  146. // ignore if same state
  147. if (cancelNextRS && (dontCancel == u) ) {
  148. dontCancel='';
  149. }
  150. else if (cancelNextRS || (u == location.pathname) ) {
  151. //cancelNextRS=false;
  152. cancelNextRS && cancelNextRS--;
  153. dontCancel='';
  154. selfTitle=blockTitle=true;
  155. return;
  156. }
  157. initial=false;
  158. firstPage=false;
  159. chkState(arguments);
  160. if (u.startsWith('/user-profile/') && (u[13] != '[') ) userID=u.split('/')[2];
  161. if ( (u == '/') || u.startsWith('/user-profile/') || u.startsWith('/styles/browse/') ) bgPage=u;
  162. pushState.apply(history, arguments);
  163. if (location.pathname.startsWith('/styles/')) {
  164. addData('from pushState (path)');
  165. }
  166. }
  167.  
  168. var hback=history.back,
  169. hforward=history.forward,
  170. hgo=history.go,
  171. hreplaceState=history.replaceState;
  172. history.replaceState=function() {
  173. if (cancelNextRS && (dontCancel == arguments[2]) ) {
  174. dontCancel='';
  175. }
  176. else if (cancelNextRS || (arguments[2] == location.pathname) ) {
  177. cancelNextRS && cancelNextRS--;
  178. dontCancel='';
  179. selfTitle=blockTitle=true;
  180. return;
  181. }
  182. initial=false;
  183. firstPage=false;
  184. return hreplaceState.apply(history, arguments);
  185. }
  186.  
  187.  
  188. window.addEventListener('popstate', (ev) => {
  189. if (location.pathname.startsWith('/user-profile/')) {
  190. if (newL.querySelector(':scope > [class^="style_mainWrapper_"]')) {
  191. let e=newL.querySelector(':scope > [class^="style_mainWrapper_"] a[data-stylish="close-style-page-button"]');
  192. if (e) {
  193. e.click();
  194. }
  195. }
  196. }
  197. else if (location.pathname.startsWith('/styles/')) {
  198. let i, r, e=document.querySelector('a[href^="'+location.pathname+'"]');
  199.  
  200. if (!e) {
  201. r=newL.querySelectorAll('[class^="styles-list_styleRow_"]');
  202. let st, ost;
  203. let ID=location.pathname.split('/')[2]
  204. for (i=0; i < r.length; i++) {
  205. if (r[i]['__reactFiber$'+reactID] && (ID == r[i]['__reactFiber$'+reactID].key.split('-').pop()) ) {
  206. e=r[i];
  207. break;
  208. }
  209. }
  210. }
  211.  
  212. if (!e) {
  213. let A=document.querySelector('a[href^="/styles/"][href*="1"]');
  214. if (A) {
  215. let react=Object.keys(A).find( (v) => v.startsWith('__reactFiber') );
  216. e=document.createElement('a');
  217. e.href=location.pathname;
  218. e.style='display: none !important;';
  219. let r=newL.querySelector(':scope > div > [class^="Home_homepageWrapper_"]')
  220. if (r) r.appendChild(e);
  221. }
  222. }
  223. if (e) e.click();
  224. }
  225. else if (location.pathname == '/') {
  226. let e=newL.querySelector(':scope > [class^="style_mainWrapper_"] a[data-stylish="close-style-page-button"]');
  227. if (e) {
  228. cancelNextRS=1;
  229. e.click();
  230. }
  231. }
  232. });
  233.  
  234. // check Title
  235. var Tit = document.querySelector('title'), selfTitle=false;
  236. new MutationObserver(function(mutations) {
  237. if (selfTitle) { selfTitle=false; return; }
  238. if (title && !Tit.textContent.startsWith(title) ) {
  239. document.title=title;
  240. selfTitle=true;
  241. }
  242. }).observe(Tit, { attributes: false, subtree: false, childList: true });
  243.  
  244. site=document.title.split('|')[1] || '';
  245. if (site) site=' |'+site;
  246.  
  247. // detect (no) popup
  248. new MutationObserver(function(mutations) {
  249. if (!newL.querySelector(':scope > [class^="style_mainWrapper_"]')) {
  250. title='';
  251. document.title=title0;
  252. if (location.pathname.startsWith('/styles/')) {
  253. if (firstPage && !initial) {
  254. }
  255. }
  256. }
  257. else {
  258. addData('from is popup');
  259. }
  260. }).observe(newL, { attributes: false, subtree: false, childList: true });
  261.  
  262. // mutation add-er
  263. new MutationObserver(function(muts) {
  264. let mut;
  265. for (mut of muts) {
  266. // new body
  267. if (mut.addedNodes.length && mut.previousSibling && (mut.previousSibling.className == 'Toastify') ) {
  268. addDataTiles();
  269.  
  270. // new list
  271. let r=newL.querySelector(':scope > .Toastify ~ div[class=""], :scope > .Toastify ~ div[class^="MainLayout_mainLayout__"]');
  272. if (r && r.attributes.obs) {
  273. return;
  274. }
  275. if (r) {new MutationObserver(function(muts) {
  276. for (mut of muts) {
  277. if (mut.addedNodes.length && mut.previousSibling && (mut.previousSibling.localName == 'header') ) {
  278. addDataTiles();
  279. watchGrid();
  280. break;
  281. }
  282. }
  283. }).observe(r, { attributes: true, subtree: false, childList: true });
  284. r.setAttribute('obs', 'tiles');
  285. }
  286.  
  287. // added cards ?
  288. watchGrid();
  289. function watchGrid() {
  290. r=newL.querySelector('[class^="styles-grid_gridItems_"]') ||
  291. newL.querySelector('[class^="styles-gallery_scrollWrapper_"] > div:not([class])');
  292. if (r.attributes.obs) {
  293. return;
  294. }
  295. if (r) {new MutationObserver(function(muts) {
  296. for (mut of muts) {
  297. if (mut.addedNodes.length) {
  298. addDataTiles();
  299. break;
  300. }
  301. }
  302. }).observe(r, { attributes: true, subtree: false, childList: true });
  303. r.setAttribute('obs', 'grid');
  304. }
  305. }
  306.  
  307. break;
  308. }
  309. }
  310. }).observe(newL, { attributes: false, subtree: false, childList: true });
  311. newL.setAttribute('obs', null);
  312.  
  313. if (location.pathname.startsWith('/styles/')) {
  314. setTimeout((e) => {addData('from ini '+v)}, 0);
  315. }
  316. }
  317.  
  318. var totalI, styleID, showCSS, loadCSS;
  319.  
  320. function getCSS(id, callback) {
  321. if (id && (typeof callback == 'function') ) {
  322. fetch('https://gateway.userstyles.org/styles/getStyleCss/'+id)
  323. .then((response) => response.json())
  324. .then((data) => callback(data));
  325. }
  326. }
  327.  
  328. function addData() {
  329. var id=styleID=location.pathname.split('/')[2],
  330. s=styles[id];
  331.  
  332. if (initial) {
  333. // this is the only case when this has to be done.
  334. var t=newL.querySelector('[class^="style-header_close_"]')
  335. if (!closeBut || (closeBut !== t) ) {
  336. closeBut=t;
  337. if (closeBut) {
  338. closeBut.addEventListener('click', function() {
  339. cancelNextRS=1;
  340. dontCancel='/';
  341. title='';
  342. document.title=title0;
  343. history.pushState({}, null, '/');
  344. });
  345. }
  346. }
  347. }
  348. if (!s) return;
  349. var a=document.querySelector('#weekly-installs');
  350. if (!a) return;
  351.  
  352. if (!totalI || !totalI._root.parentNode) {
  353. totalI=a.cloneNode(true);
  354. totalI.id='totalInstalls';
  355. totalI.dataset.tooltipContent='';
  356. totalI._v=totalI.querySelector(':scope div span');
  357. totalI._v.textContent='';
  358. var tt=a.nextElementSibling, ttTI;
  359. if ( tt.attributes.role && (tt.attributes.role.value == 'tooltip') ) ttTI=tt.cloneNode(true);
  360. if (!ttTI) {
  361. ttTI=document.createElement('div');
  362. ttTI.innerHTML='<div role="tooltip" _model class="react-tooltip styles-module_tooltip__mnnfp styles-module_dark__xNqje react-tooltip__place-top styles-module_show__2NboJ" style="visibility: hidden;">test<div class="react-tooltip-arrow styles-module_arrow__K0L3T" style="left: 40px; bottom: -4px;"></div></div>';
  363. ttTI=ttTI.firstElementChild;
  364. tt=totalI;
  365. }
  366. if (ttTI) {
  367. a.parentNode.insertBefore(ttTI, tt.nextSibling);
  368. if (ttTI.childNodes.length == 1) {
  369. let T=document.createTextNode('Total installs');
  370. ttTI.insertBefore(T, ttTI.firstChild);
  371. }
  372. else ttTI.childNodes[0].textContent='Total installs';
  373. totalI.onmouseenter=function(){
  374. ttTI.style.opacity='0.9';
  375. ttTI.style.visibility='visible';
  376. if (ttTI._init) return;
  377. ttTI._init=true;
  378. if (ttTI.attributes._model) {
  379. ttTI.style.top=(totalI.offsetTop - 47) +'px';
  380. ttTI.style.left=(totalI.offsetLeft -10) +'px';
  381. }
  382. else {
  383. ttTI.style.left=(totalI.offsetLeft - a.offsetLeft + tt.offsetLeft)+'px';
  384. ttTI.style.top=tt.style.top;
  385. ttTI.firstElementChild.setAttribute('style', tt.firstElementChild.attributes.style.value);
  386. }
  387. };
  388. totalI.onmouseleave=function(){ttTI.style.opacity='0'; ttTI.style.visibility='hidden';};
  389. }
  390. var i=totalI.querySelector(':scope > svg'), i2;
  391. if (i) {
  392. i2=i.cloneNode(true);
  393. totalI.insertBefore(i2, i.nextSibling);
  394. i2.style='margin-left: -17px';
  395. }
  396. a.parentNode.insertBefore(totalI, (tt || a).nextSibling);
  397. totalI._root=totalI.closest('[class^="style_mainWrapper_"]');
  398.  
  399. showCSS=totalI._root.querySelector('[class*="style-info_showCss_"]');
  400. if (showCSS) {
  401. new MutationObserver(function(mutations) {
  402. let e;
  403. if (e=showCSS.parentNode.querySelector('[class^="Popup_modalWrapper_"] textarea')) {
  404. if (loadCSS) {loadCSS=0; return;}
  405. if (styles[styleID].sourceCode) e.value=styles[styleID].sourceCode;
  406. else {
  407. e.value='';
  408. getCSS(styleID, function(v){e.value=styles[styleID].sourceCode=v.result;} );
  409. }
  410. }
  411. }).observe(showCSS.parentNode, { attributes: false, subtree: false, childList: true });
  412. }
  413. }
  414. else {
  415. let e=totalI._root.querySelector('[class^="Popup_modalWrapper_"] textarea');
  416. if (e) {
  417. if (styles[styleID].sourceCode) e.value=styles[styleID].sourceCode;
  418. else {
  419. e.value='';
  420. getCSS(styleID, function(v){e.value=styles[styleID].sourceCode=v.result;} );
  421. }
  422. }
  423. }
  424.  
  425. let v=parseInt(s.totalInstallsCount);
  426. let vd=a.querySelector('span'), vdv=vd.innerText;
  427. if (vdv.endsWith('k')) vdv=Math.floor(parseFloat(vdv) * 1000);
  428. else vdv=parseInt(vdv);
  429. if (vdv > v) {vd.style='text-decoration: line-through; text-decoration-color: red;';}
  430. else vd.style='';
  431. if (v > 1000) v=(v/1000).toFixed(1)+'k';
  432. totalI._v.textContent=v;
  433. document.title=title=s.name+site;
  434.  
  435. setTimeout(function(){
  436. if (!totalI._root.parentNode) addData('after');
  437. },10);
  438. }
  439.  
  440. function addDataTiles() {
  441. var a=document.querySelectorAll('[data-stylish^="strip-cube-styles"]:not(._done), [data-stylish^="grid-cube-styles"]:not(._done)');
  442. a.forEach((e) => e.classList.add('_done'));
  443. var i=0;
  444. add2Tiles();
  445. function add2Tiles() {
  446. var max=Date.now() + 100;
  447. for (; i < a.length; i++) {
  448. if (Date.now() > max) {
  449. setTimeout(add2Tiles, 0);
  450. return;
  451. }
  452. let e=a[i].querySelector('[class*="style-cube_activeUsers_"]');
  453. if (!e) continue;
  454. let h=a[i].querySelector('a[href^="/styles/"]');
  455. if (!h) continue;
  456. let s=styles[h.pathname.split('/')[2]];
  457. if (!s) continue;
  458. let r=a[i].querySelector('[class^="style-cube_styleDetails_"]');
  459.  
  460. let tot=e.cloneNode(true);
  461. e.title='Weekly installs';
  462. tot.classList.add('_totalInstalls');
  463. tot.title='Total installs';
  464. let _v=tot.querySelector(':scope div span');
  465. _v.textContent='';
  466. let I=tot.querySelector(':scope > svg'), i2;
  467. if (I) {
  468. i2=I.cloneNode(true);
  469. tot.insertBefore(i2, I.nextSibling);
  470. i2.style='margin-left: -9px';
  471. }
  472. // insert total
  473. e.parentNode.insertBefore(tot, e);
  474. let v=parseInt(s.totalInstallsCount);
  475. if (v > 1000) v=(v/1000).toFixed(1)+'k';
  476. _v.textContent=v;
  477. // add dates
  478. e=document.createElement('div');
  479. e.className='_dates_';
  480. let C=s.created.split('T')[0], U=s.updated.split('T')[0];
  481. e.innerHTML=(C == U ? '':'<span title="Last updated">'+U+'</span>')+'<span title="Date created">'+C+'</span>';
  482. r.appendChild(e);
  483. // add user name
  484. e=a[i].querySelector('[class^="style-cube_authorAvatar_"]');
  485. if (e) e.title=s.user.name;
  486. }
  487. }
  488. }
  489.  
  490.  
  491. var iST=`
  492. .hideMe {
  493. display: none;
  494. }
  495. div[class^="style_mainWrapper__"] {
  496. padding-top: 0;
  497. }
  498.  
  499. [data-stylish^="strip-cube-styles"] [class^="style-cube_topWrapper_"],
  500. [data-stylish^="grid-cube-styles"] [class^="style-cube_topWrapper_"] {
  501. margin-bottom: 0;
  502. }
  503. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"],
  504. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] {
  505. flex-direction: row wrap;
  506. background: var(--bg, gray);
  507. margin-top: 2px;
  508. transition: unset !important;
  509. transition-delay: unset !important;
  510. padding-top: 2px;
  511. color: white;
  512. }
  513. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] > *,
  514. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] > * {
  515. text-overflow: ellipsis;
  516. overflow: hidden;
  517. word-break: break-all;
  518. }
  519. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_activeUsers_"],
  520. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_activeUsers_"] {
  521. width: auto !important;
  522. margin-left: auto;
  523. }
  524. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_activeUsers_"] + [class^="style-cube_activeUsers_"],
  525. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_activeUsers_"] + [class^="style-cube_activeUsers_"] {
  526. margin-left: 1em;
  527. }
  528. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_activeUsers_"] svg,
  529. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_activeUsers_"] svg {
  530. fill: white;
  531. display: block;
  532. }
  533. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_name_"] *,
  534. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] [class^="style-cube_name_"] * {
  535. text-overflow: ellipsis;
  536. overflow: hidden;
  537. }
  538. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] > [class^="style-cube_styleName_"],
  539. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] > [class^="style-cube_styleName_"] {
  540. oline-height: normal;
  541. flex-basis: calc(100% - 40px);
  542. }
  543. [data-stylish^="strip-cube-styles"] [class^="style-cube_styleDetails_"] > [class^="style-cube_details_"],
  544. [data-stylish^="grid-cube-styles"] [class^="style-cube_styleDetails_"] > [class^="style-cube_details_"] {
  545. width: auto !important;
  546. margin-left: auto;
  547. ooutline: 2px solid red !important;
  548. }
  549.  
  550. [data-stylish^="strip-cube-styles"] [class*="style-cube_withHover_"]:hover,
  551. [data-stylish^="grid-cube-styles"] [class*="style-cube_withHover_"]:hover {
  552. transform: unset !important;
  553. transition: unset !important;
  554. transition-delay: unset !important;
  555. background-color: unset !important;
  556. --bg: DarkSlateGrey;
  557. }
  558.  
  559. ._dates_._dates_ {
  560. flex-basis: 100%;
  561. margin-top: 2px;
  562. text-align: right;
  563. }
  564. ._dates_ span {
  565. color: lightgray;
  566. font-size: 11px;
  567. }
  568. ._dates_ span + span {
  569. margin-left: 1em;
  570. }
  571.  
  572. [class^="styles-strip_stripItemsWrapper_"] > button {
  573. display: none !important;
  574. }
  575. [class^="styles-strip_stripItemsWrapper_"] {
  576. overflow-x: scroll;
  577. padding-bottom: 4px;
  578. }
  579. [class^="styles-strip_stripItemsWrapper_"]::-webkit-scrollbar {
  580. height: 8px !important;
  581. }
  582. [class^="styles-strip_items_"] {
  583. transform: unset !important;
  584. }
  585.  
  586. :not(g):not(button):not([class^="style_mainWrapper_"])) {
  587. transform: unset !important;
  588. transition: unset !important;
  589. transition-delay: unset !important;
  590. }
  591. svg[transform*="rotate(-180)"] {
  592. transform: rotate(-180deg) !important;
  593. }
  594.  
  595. [class^="category-filter_borderRadios_"] {
  596. display: none;
  597. }
  598.  
  599. [class^="styles-list_styleName_"] {
  600. word-break: break-word;
  601. }
  602.  
  603. [role="tooltip"] .react-tooltip-arrow {
  604. bottom: -7px !important;
  605. border-color: var(--rt-color-dark) transparent;
  606. border-style: solid;
  607. border-width: 7px 7px 0 7px;
  608. display: block;
  609. background: transparent;
  610. transform: none;
  611. }
  612.  
  613. #totalInstalls {
  614. order: -1;
  615. }
  616. `;
  617.  
  618. addSt();
  619.  
  620. var ST;
  621. function addSt() {
  622. if (!iST) {
  623. document.documentElement.appendChild(ST);
  624. return;
  625. }
  626. try {
  627. ST=document.createElement('style');
  628. document.documentElement.appendChild(ST);
  629. ST.textContent=iST;
  630. iST='';
  631. }catch(e){
  632. setTimeout(addSt,0); }
  633. }
  634.  
  635.  
  636. })();