Greasy Fork镜像 支持简体中文。

Brainy MOD Menu (Dark theme)

BRAINLY DARK MODE

  1. // ==UserScript==
  2. // @name Brainy MOD Menu (Dark theme)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.6
  5. // @description BRAINLY DARK MODE
  6. // @author KAI SMITH (@Hakar) & Triggerman
  7. // @match *://*brainly.in/*
  8. // @match *://*brainly.com/*
  9. // @match *://*brainly.it/*
  10. // @match *://*brainly.co.id/*
  11. // @match *://*nosdevoirs.fr/*
  12. // @match *://*brainly.ro/*
  13. // @match *://*brainly.ph/*
  14. // @match *://*brainly.lat/*
  15. // @match *://*eodev.com/*
  16. // @match *://*znanija.com/*
  17. // @match *://*brainly.pl/*
  18. // @match *://*brainly.com.br/*
  19. // @icon https://i.pinimg.com/originals/b9/7b/02/b97b02641851c9f012813e7e6714dd1f.jpg
  20. // @grant GM.xmlHttpRequest
  21. // @grant GM_addStyle
  22. // @grant GM_notification
  23. // @grant GM_getValue
  24. // @grant GM_setValue
  25. // @grant GM_registerMenuCommand
  26. // @run-at document-start
  27. // @noframes
  28. // @license MIT; https://mit-license.org/
  29. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
  30.  
  31.  
  32. // ==/UserScript==
  33. // ALL RIGHT RESERVED BY KAI SMITH & TRIGGERMAN
  34. // We are not responsible of any misuse of this script
  35. // Don't touch cfgs, else it mays never work unless you reinstall everything and remove your cookies.
  36. // If there is a problem contact me thanks to this email : emadel50838@gmail.com
  37. // Keep tampermonkey updated , don't worry it update itself.
  38. // Thanks Brainly, for CSS styling
  39. // Don't try to use this code to make a hack , else, sorry mate you are in the wrong way.
  40. // No ads-blocker in this code, Brainly is free thanks to ads :).
  41. // Don't be a night owl :p, tommorow you need to wake up early
  42. // Enjoy
  43.  
  44.  
  45. /*--- Create a button in a container div. It will be styled and
  46. positioned with CSS.
  47. */
  48. var zNode = document.createElement ('div');
  49. zNode.innerHTML = '<span class="sg-button__icon"><div id="parameters" class="sg-icon sg-icon--adaptive sg-icon--x24"><svg class="sg-icon__svg"><use xlink:href="#icon-settings"></use></svg></div></span><button class="sg-button sg-button--solid-mint" id="myButton" type="button">'
  50. + 'Check Point Transfering</button>'
  51. + ' <label class="switch"><input id="Checkbox" type="checkbox"><span class="slider round"></span></label>'
  52. + '<p id="darkmodetext">Dark Mode</p>'
  53. ;
  54. zNode.setAttribute ('id', 'myContainer');
  55. zNode.setAttribute ('class', 'sg-box sg-box--no-border sg-box brn-white-background-box-light-gray');
  56. zNode.setAttribute ('class', 'vertical-center');
  57. document.body.appendChild (zNode);
  58.  
  59.  
  60.  
  61. // Getting the brainly ranking throught xmlrequest
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. //--- Activate the newly added button.
  69. document.getElementById ("myButton").addEventListener (
  70. "click", ButtonClickAction, false
  71. );
  72.  
  73.  
  74.  
  75.  
  76.  
  77. function ButtonClickAction (zEvent) {
  78. alert("You didn't download this feature");
  79. }
  80.  
  81.  
  82.  
  83.  
  84. //--- Style our newly added elements using CSS.
  85. GM_addStyle ( multilineStr ( function () {/*!
  86. #myContainer {
  87. position: fixed;
  88. top: 60px;
  89. left: 26px;
  90. font-size: 20px;
  91. background: linear-gradient(217deg, rgb(13 255 0 / 80%), rgba(255,0,0,0) 70.71%), linear-gradient(127deg, rgb(0 255 243 / 80%), rgba(0,255,0,0) 70.71%), linear-gradient(336deg, rgb(0 243 255 / 80%), rgba(0,0,255,0) 70.71%); border: none;
  92. margin: 20px;
  93. opacity: 0.9;
  94. z-index: 222;
  95. height: 25px;
  96. width: 25px;
  97. padding: 70px 120px;
  98. text-align: center;
  99. }
  100.  
  101. #vertical-center {
  102. margin: 0;
  103. position: absolute;
  104. top: 10%;
  105. -ms-transform: translateY(-50%);
  106. transform: translateY(-50%);
  107. }
  108. .switch {
  109. position: fixed;
  110. top: 117px;
  111. left: 55px;
  112. display: inline-block;
  113. width: 30px;
  114. height: 14px;
  115. }
  116.  
  117. .switch input {
  118. opacity: 0;
  119. width: 0;
  120. height: 0;
  121. }
  122.  
  123. .slider {
  124. position: absolute;
  125. cursor: pointer;
  126. top: 0;
  127. left: 0;
  128. right: 0;
  129. bottom: 0;
  130. background-color: #ccc;
  131. -webkit-transition: .4s;
  132. transition: .4s;
  133. }
  134.  
  135. .slider:before {
  136. position: absolute;
  137. content: "";
  138. height: 11px;
  139. width: 11px;
  140. left: 2px;
  141. bottom: 2px;
  142. background-color: white;
  143. -webkit-transition: .4s;
  144. transition: .4s;
  145. }
  146.  
  147. input:checked + .slider {
  148. background-color: #2196F3;
  149. }
  150.  
  151. input:focus + .slider {
  152. box-shadow: 0 0 1px #2196F3;
  153. }
  154.  
  155. input:checked + .slider:before {
  156. -webkit-transform: translateX(26px);
  157. -ms-transform: translateX(26px);
  158. transform: translateX(16px);
  159. }
  160.  
  161. .slider.round {
  162. border-radius: 14px;
  163. }
  164.  
  165. .slider.round:before {
  166. border-radius: 50%;
  167. }
  168. #myButton {
  169.  
  170. cursor: pointer;
  171. position: fixed;
  172. top: 70px;
  173. left: 44px;
  174.  
  175. }
  176. #darkmodetext {
  177. position: fixed;
  178. top: 111px;
  179. left: 86px;
  180. }
  181. #Checkbox {
  182. cursor: pointer;
  183. position: fixed;
  184. top: 115px;
  185. left: 66px;
  186. display: inline-block;
  187.  
  188.  
  189.  
  190. }
  191.  
  192. #parameters {
  193. position: fixed;
  194. top: 60px;
  195. left: 26px;
  196.  
  197.  
  198. }
  199.  
  200.  
  201. label {
  202. display:flex;
  203. align-items: baseline;
  204. }
  205.  
  206. input[type=checkbox] {
  207. margin-right: 8px;
  208. }
  209. */} ) );
  210.  
  211. function multilineStr (dummyFunc) {
  212. var str = dummyFunc.toString ();
  213. str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  214. .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  215. .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  216. ;
  217. return str;
  218. };
  219.  
  220.  
  221.  
  222. window.onload = function ChangeTheme() {
  223. 'use strict';
  224. console.log(cfg);
  225. console.log(cfg_excl);
  226. var el;
  227. var css;
  228. var cfg_color;
  229. var cfg_bgclr;
  230. var cfg_visclr;
  231. var cfg_excl;
  232. var cfg_css;
  233. var cfg_js;
  234. var cfg_active = (localStorage.getItem('active') === 'true');
  235. function load_settings()
  236. {
  237. cfg_excl = localStorage.getItem('excl') || "";
  238. cfg_excl = cfg_excl+"#myButton,.brn-progress-tracking__icon-dot,#sg-counter--xxs,.sg-search__icon,.sg-box--dark,.sg-box--blue,.sg-text--break-words,.sg-icon--gray-secondary,.sg-icon--gray-light,.game-box__dashed-progress-bar,.sg-text--full,.brn-qpage-next-question-box-content__primary,.sg-text--break-words,.brn-answering-streak__front-element,.brn-moderation-panel__button sg-button,.brn-answering-dot,.brn-answers-tracking__bar-filling--animated,.brn-answers-tracking__bar";
  239. cfg_css = localStorage.getItem('css') || "";
  240. cfg_css = cfg_css+'.sg-counter--xxs { min-height: 25px; min-width: 25px; height: 16px; padding: 0 9px; border-radius: 25px; }.sg-button--transparent { background-color: rgba(255,255,255,0); color: #ff7968; fill: #ff7968; }.brn-challenge-confetti__container { display: block; position: absolute; color: #27eBA7; border-radius: 8px; top: 2px; left: 0; z-index: 3; height: 40px; width: 100%; background: -webkit-gradient(linear,left bottom,left top,from(hsla(0,0%,100%,0)),to(#27eBA7)); background: -webkit-linear-gradient(bottom,hsla(0,0%,100%,0),#27eBA7); background: linear-gradient(0deg,hsla(0,0%,100%,0) 0,#27eBA7);}.brn-challenge-confetti__container:before { display: block; position: absolute; border-radius: 8px; bottom: 2px; left: 0; z-index: 2; height: 30px; width: 100%;}.HeaderController__subnavWrapper--1mfz7:after { display: block; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #27eBA7;}.sg-box--blue { background-color: #27eBA7; } .sg-box--dark { background: #ff7968; }.sg-icon--gray-secondary { fill: #ff7968; }.sg-icon--gray-light { fill: #27eBA7 ; }.sg-text--full { width: 100%; color: #27eBA7; }.brn-qpage-next-question-box-content__primary { display: block; color: #27eBA7; }.brn-moderation-panel__button sg-button { color: #27eBA7; }.brn-answering-dot { border-radius: 50%; background-color: #27eBA7; height: 16px; width: 16px; margin-right: 8px; -webkit-animation-name: jump; animation-name: jump; -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-timing-function: ease; animation-timing-function: ease; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; }.brn-answers-tracking__bar { background-color: #27eBA7; height: 8px; border-radius: 8px; min-width: calc(100% - 24px); width: 100%; }'
  241. cfg_js = localStorage.getItem('js') || "";
  242.  
  243. window.onload = function geturl(){
  244. var url = document.URL
  245. console.log(url)
  246. if (url="https://brainly.in/"){
  247. cfg_excl = cfg_excl+",.sg-text--break-words"
  248. cfg_css = cfg_css+".sg-text--break-words { word-break: break-word; color: #27eBA7; }"
  249. }}
  250.  
  251. if (typeof GM_getValue !== "undefined")
  252. {
  253. cfg_color = GM_getValue("Color", "#27eBA7");
  254. cfg_bgclr = GM_getValue("bgColor", "#2d4870");
  255. cfg_visclr = GM_getValue("visitedColor", "#a4a4a4");
  256. }
  257. }
  258.  
  259. function activate(yes, prev_active)
  260. {
  261. if(prev_active && el){document.body.removeChild(el);}
  262. if(yes)
  263. {
  264. make_css();
  265. el = GM_addStyle(css);
  266. el = document.body.appendChild(el);
  267. if(cfg_js){eval(cfg_js);}
  268. }
  269. }
  270. document.getElementById ("Checkbox").addEventListener (
  271. "click", toggleDT, false
  272. );
  273.  
  274. function toggleDT()
  275. {
  276. load_settings();
  277. let prev_active = cfg_active;
  278. cfg_active = !(localStorage.getItem('active') === 'true');
  279. activate(cfg_active, prev_active);
  280. if(!cfg_active)
  281. {
  282. localStorage.removeItem('active');
  283. }
  284. else
  285. {
  286. localStorage.setItem('active', "true");
  287. }
  288. }
  289.  
  290. if (typeof GM_registerMenuCommand !== "undefined")
  291. {
  292. GM_registerMenuCommand("Brainly Dark Theme Configuration", cfg, "D");
  293. GM_registerMenuCommand("Toggle Brainly Dark Theme", toggleDT, "T");
  294. }
  295.  
  296. function make_css()
  297. {
  298.  
  299. let exclusions;
  300. let exc_txt = ""
  301. if(cfg_excl !== "")
  302. {
  303. exclusions = cfg_excl.split(",");
  304. for (var i = 0, len = exclusions.length; i < len; i++)
  305. {
  306. exc_txt += ":not("+exclusions[i]+")";
  307. }
  308. }
  309. css = `
  310. *`+exc_txt+` {
  311. color: `+cfg_color+` !important;
  312. background: `+cfg_bgclr+` !important;
  313. border-color: `+cfg_color+` !important;
  314. }
  315. :visited`+exc_txt+`, a:hover`+exc_txt+` {
  316. color: `+cfg_visclr+` !important;
  317. }
  318. `+cfg_css+`
  319. `;
  320. //////////////
  321. }
  322.  
  323. if(cfg_active)
  324. {
  325. load_settings();
  326. make_css();
  327. el = GM_addStyle(css);
  328. document.addEventListener("DOMContentLoaded", function(){ el = document.body.appendChild(el); if(cfg_js){eval(cfg_js);} });
  329. }
  330.  
  331. var t;
  332.  
  333.  
  334.  
  335.  
  336. function cfg()
  337. {
  338. if (typeof GM_setValue !== "undefined")
  339. {
  340. function saveCfg()
  341. {
  342. GM_setValue("Color", document.getElementById("color").value);
  343. GM_setValue("bgColor", document.getElementById("bgclr").value);
  344. GM_setValue("visitedColor", document.getElementById("visitedColor").value);
  345. localStorage.setItem('excl', document.getElementById("excl").value);
  346. localStorage.setItem('css', document.getElementById("css").value);
  347. localStorage.setItem('js', document.getElementById("js").value);
  348. localStorage.setItem('active', document.getElementById("active").checked);
  349. // pretty text "saved"
  350. document.getElementById("cfg_save").value = "SAVED !";
  351. clearTimeout(t);
  352. t = setTimeout(function() {document.getElementById("cfg_save").value = "Save configuration";},1500)
  353. // update active configuration
  354. cfg_color = document.getElementById("color").value;
  355. cfg_bgclr = document.getElementById("bgclr").value;
  356. cfg_visclr = document.getElementById("visitedColor").value;
  357. cfg_excl = document.getElementById("excl").value;
  358. cfg_css = document.getElementById("css").value;
  359. cfg_js = document.getElementById("js").value;
  360. activate(document.getElementById("active").checked, cfg_active );
  361. cfg_active = document.getElementById("active").checked;
  362. // clean up
  363. if(!document.getElementById("active").checked) { localStorage.removeItem('active'); }
  364. if(!document.getElementById("excl").value) { localStorage.removeItem('excl'); }
  365. if(!document.getElementById("css").value) { localStorage.removeItem('css'); }
  366. if(!document.getElementById("js").value) { localStorage.removeItem('js'); }
  367. }
  368. load_settings();
  369. var div = document.createElement("div");
  370. div.style.position = "fixed";
  371. div.style.top = "5%";
  372. div.style.left = "50%";
  373. div.style.margin = "5% -222px";
  374. div.style.width = "444px";
  375. div.style.border = "solid 1px black";
  376. div.style.backgroundColor = cfg_bgclr;
  377. div.style.color = cfg_color;
  378. div.style.zIndex = 8888888;
  379. div.style.lineHeight = 1.0;
  380. div.innerHTML = "<b><center>Configuration</center></b>"
  381. + "<br><br><input id='color' type='text' size='7' style='display:inline; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; width:initial; padding: initial;'> Text color (empty = site default)"
  382. + "<br><br><input id='bgclr' type='text' size='7' style='display:inline; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; width:initial; padding: initial;'> Background color"
  383. + "<br><br><input id='visitedColor' type='text' size='7' style='display:inline; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; width:initial; padding: initial;'> Visited & hovered links color"
  384. + "<br><br><center><b>Per-site settings (stored in browser cookies called LocalStorage):</b>"
  385. + "<br><br><input id='active' type='checkbox' style='display:inline; width:initial; padding: initial;'> Enabled for this website"
  386. + "<br><br>Excluded css elements (e.g. \"#id1,.class2,input\"):<br><textarea id='excl' style='margin: 0px; width: 400px; height: 50px; resize:both; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; display:inline; padding: initial;'></textarea>"
  387. + "<br><br>Custom CSS style:<br><textarea id='css' style='margin: 0px; width: 400px; height: 50px; resize:both; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; display:inline; padding: initial;'></textarea>"
  388. + "<br><br>Custom JS Action:<br><textarea id='js' style='margin: 0px; width: 400px; height: 50px; resize:both; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; display:inline; padding: initial;'></textarea>"
  389. + "<br><input id='cfg_save' type='button' value='Save configuration' style='display:inline; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; width:initial; padding: initial;'> <input id='cfg_close' type='button' value='Close' style='display:inline; color: "+cfg_color+"; background-color: "+cfg_bgclr+"; width:initial; padding: initial;'></center>";
  390. document.body.appendChild(div);
  391. document.getElementById("color").value = cfg_color;
  392. document.getElementById("bgclr").value = cfg_bgclr;
  393. document.getElementById("visitedColor").value = cfg_visclr;
  394. //
  395. document.getElementById("active").checked = cfg_active;
  396. document.getElementById("excl").value = cfg_excl;
  397. document.getElementById("css").value = cfg_css;
  398. document.getElementById("js").value = cfg_js;
  399. document.getElementById("cfg_save").addEventListener("click", saveCfg, true);
  400. document.getElementById("cfg_close").addEventListener("click", function(){div.remove();clearTimeout(t);}, true);
  401. }
  402. else
  403. {
  404. alert("Sorry, Chrome userscripts in native mode can't have configurations! Install TamperMonkey userscript-manager extension");
  405. }
  406. }
  407.  
  408. }();
  409.  
  410.  
  411.  
  412.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址