Brainy MOD Menu (Dark theme)

BRAINLY MOD MENU (Dark mode+Check Point transfering user,only for mods, no use for users)

  1. // ==UserScript==
  2. // @name Brainy MOD Menu (Dark theme)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9
  5. // @description BRAINLY MOD MENU (Dark mode+Check Point transfering user,only for mods, no use for users)
  6. // @author KAI SMITH (@Hakar) & Triggerman
  7. // @match *://*brainly.in/*
  8. // @match *://*brainly.it/*
  9. // @match *://*brainly.co.id/*
  10. // @match *://*nosdevoirs.fr/*
  11. // @match *://*brainly.ro/*
  12. // @match *://*brainly.ph/*
  13. // @match *://*brainly.lat/*
  14. // @match *://*eodev.com/*
  15. // @match *://*znanija.com/*
  16. // @match *://*brainly.pl/*
  17. // @match *://*brainly.com.br/*
  18. // @icon https://i.pinimg.com/originals/b9/7b/02/b97b02641851c9f012813e7e6714dd1f.jpg
  19. // @grant GM.xmlHttpRequest
  20. // @grant GM_addStyle
  21. // @grant GM_notification
  22. // @grant GM_getValue
  23. // @grant GM_setValue
  24. // @grant GM_registerMenuCommand
  25. // @run-at document-start
  26. // @noframes
  27. // @license MIT; https://mit-license.org/
  28. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
  29.  
  30.  
  31. // ==/UserScript==
  32. // ALL RIGHT RESERVED BY KAI SMITH & TRIGGERMAN
  33. // We are not responsible of any misuse of this script
  34. // Don't touch cfgs, else it mays never work unless you reinstall everything and remove your cookies.
  35. // If there is a problem contact me thanks to this email : emadel50838@gmail.com
  36. // Keep tampermonkey updated , don't worry it update itself.
  37. // Thanks Brainly, for CSS styling
  38. // Don't try to use this code to make a hack , else, sorry mate you are in the wrong way.
  39. // No ads-blocker in this code, Brainly is free thanks to ads :).
  40. // Don't be a night owl :p, tommorow you need to wake up early
  41. // Enjoy
  42.  
  43.  
  44. /*--- Create a button in a container div. It will be styled and
  45. positioned with CSS.
  46. */
  47.  
  48.  
  49.  
  50. var zNode = document.createElement ('div');
  51. 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">'
  52. + 'Check Point Transfering</button>'
  53. + ' <label class="switch"><input id="Checkbox" type="checkbox"><span class="slider round"></span></label>'
  54. + '<p id="darkmodetext">Dark Mode</p>'
  55. + '<button id="deletebutton" class="sg-button sg-button--s sg-button--solid"> <span class="sg-button__icon"> <div class="sg-icon sg-icon--adaptive sg-icon--x24"> <svg class="sg-icon__svg"> <use xlink:href="#icon-settings"></use> </svg> </div> </span> <span class="sg-button__text">Delete Question Author</span> </button>'
  56. ;
  57. zNode.setAttribute ('id', 'myContainer');
  58. zNode.setAttribute ('class', 'sg-box sg-box--no-border sg-box brn-white-background-box-light-gray');
  59. zNode.setAttribute ('class', 'vertical-center');
  60. document.body.appendChild (zNode);
  61. // Making the checkbox updated to the dark mode
  62. $(function(){
  63. var test = localStorage.input === 'true'? true: false;
  64. $('input').prop('checked', test || false);
  65. });
  66.  
  67. $('input').on('change', function() {
  68. localStorage.input = $(this).is(':checked');
  69. console.log($(this).is(':checked'));
  70. });
  71.  
  72.  
  73.  
  74. // Getting the brainly ranking through xmlrequest
  75.  
  76. GM.xmlHttpRequest({
  77. method: "GET",
  78. url: "/api/28/api_global_rankings/view/0/1",
  79. headers: {
  80. "User-Agent": "Chrome/83.0.4103.116", // If not specified, navigator.userAgent will be used.
  81. "Accept": "text/xml" // If not specified, browser defaults will be used.
  82. },
  83. onload: function(response) {
  84. var responseXML = null;
  85. // Inject responseXML into existing Object (only appropriate for XML content).
  86. if (!response.responseXML) {
  87. responseXML = new DOMParser()
  88. .parseFromString(response.responseText, "text/xml");
  89. }
  90. var data = JSON.parse(response.responseText);
  91. console.log(data);
  92. var firstuser = {points:data.data[0].value,nick:data.users_data[0].nick, id:data.users_data[0].id, rank:data.users_data[0].ranks.names[0]};
  93. var seconduser = {points:data.data[1].value,nick:data.users_data[1].nick, id:data.users_data[1].id, rank:data.users_data[1].ranks.names[0]};
  94. var thirduser = {points:data.data[2].value,nick:data.users_data[2].nick, id:data.users_data[2].id,rank:data.users_data[2].ranks.names[0]};
  95.  
  96.  
  97.  
  98.  
  99. //--- Activate the newly added button.
  100. document.getElementById ("myButton").addEventListener (
  101. "click", ButtonClickAction, false
  102. );
  103. document.getElementById ("deletebutton").addEventListener (
  104. "click", deleteid, false
  105. );
  106. function deleteid() {
  107.  
  108.  
  109. confirm("are yous sure you want to delete s account ?");
  110.  
  111. }
  112.  
  113.  
  114.  
  115. function ButtonClickAction (zEvent) {
  116. var zNode = document.createElement ('p');
  117. var href1 = "/profile/"+firstuser.nick+"-"+firstuser.id;
  118. var href2 = "/profile/"+seconduser.nick+"-"+seconduser.id;
  119. var href3 = "/profile/"+thirduser.nick+"-"+thirduser.id;
  120.  
  121. zNode.innerHTML = '<p id="UserList"><a style="background-color:Gold;" href="'+href1+'" target="_blank">'+"⚠️"+firstuser.nick+'</a>-'+firstuser.points+' points '+firstuser.rank+'</p><br><p><a style="background-color:Orange;" href="'+href2+'"target="_blank">'+"⚠️"+seconduser.nick+'</a>-'+seconduser.points+' points '+seconduser.rank+'</p><br><p><a style="background-color:Gray;" href="'+href3+'"target="_blank">'+"⚠️"+thirduser.nick+'</a>-'+thirduser.points+' points '+thirduser.rank+'</p>';
  122. document.getElementById ("myContainer").appendChild (zNode);
  123. $(document).ready(function(){
  124. $("#myButton").click(function(){
  125. $(zNode).toggle();
  126. });
  127. });
  128. }
  129.  
  130.  
  131.  
  132.  
  133. //--- Style our newly added elements using CSS.
  134. GM_addStyle ( multilineStr ( function () {/*!
  135. #myContainer {
  136. position: fixed;
  137. top: 60px;
  138. left: 26px;
  139. font-size: 20px;
  140. 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;
  141. margin: 20px;
  142. opacity: 0.9;
  143. z-index: 222;
  144. height: 25px;
  145. width: 25px;
  146. padding: 70px 120px;
  147. text-align: center;
  148. }
  149.  
  150. #deletebutton {
  151.  
  152. cursor: pointer;
  153. position: fixed;
  154. top: 112px;
  155. left: 48px;
  156.  
  157.  
  158. }
  159.  
  160. #vertical-center {
  161. margin: 0;
  162. position: absolute;
  163. top: 10%;
  164. -ms-transform: translateY(-50%);
  165. transform: translateY(-50%);
  166. }
  167. .switch {
  168. position: fixed;
  169. top: 152px;
  170. left: 55px;
  171. display: inline-block;
  172. width: 30px;
  173. height: 14px;
  174. }
  175.  
  176. .switch input {
  177. opacity: 0;
  178. width: 0;
  179. height: 0;
  180. }
  181.  
  182. .slider {
  183. position: absolute;
  184. cursor: pointer;
  185. top: 0;
  186. left: 0;
  187. right: 0;
  188. bottom: 0;
  189. background-color: #ccc;
  190. -webkit-transition: .4s;
  191. transition: .4s;
  192. }
  193.  
  194. .slider:before {
  195. position: absolute;
  196. content: "";
  197. height: 11px;
  198. width: 11px;
  199. left: 2px;
  200. bottom: 2px;
  201. background-color: white;
  202. -webkit-transition: .4s;
  203. transition: .4s;
  204. }
  205.  
  206. input:checked + .slider {
  207. background-color: #ff7968;
  208. }
  209.  
  210. input:focus + .slider {
  211. box-shadow: 0 0 1px #ff7968;
  212. }
  213.  
  214. input:checked + .slider:before {
  215. -webkit-transform: translateX(26px);
  216. -ms-transform: translateX(26px);
  217. transform: translateX(16px);
  218. }
  219.  
  220. .slider.round {
  221. border-radius: 14px;
  222. }
  223.  
  224. .slider.round:before {
  225. border-radius: 50%;
  226. }
  227. #myButton {
  228.  
  229. cursor: pointer;
  230. position: fixed;
  231. top: 70px;
  232. left: 44px;
  233.  
  234. }
  235. #darkmodetext {
  236. position: fixed;
  237. top: 145px;
  238. left: 86px;
  239. }
  240. #Checkbox {
  241. cursor: pointer;
  242. position: fixed;
  243. top: 115px;
  244. left: 66px;
  245. display: inline-block;
  246.  
  247.  
  248.  
  249. }
  250.  
  251. #parameters {
  252. position: fixed;
  253. top: 60px;
  254. left: 26px;
  255.  
  256.  
  257. }
  258.  
  259.  
  260. label {
  261. display:flex;
  262. align-items: baseline;
  263. }
  264.  
  265. input[type=checkbox] {
  266. margin-right: 8px;
  267. }
  268. */} ) );
  269.  
  270. function multilineStr (dummyFunc) {
  271. var str = dummyFunc.toString ();
  272. str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  273. .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  274. .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  275. ;
  276. return str;
  277. }}});
  278.  
  279.  
  280.  
  281. window.onload = function ChangeTheme() {
  282. 'use strict';
  283. console.log(cfg);
  284. console.log(cfg_excl);
  285. var el;
  286. var css;
  287. var cfg_color;
  288. var cfg_bgclr;
  289. var cfg_visclr;
  290. var cfg_excl;
  291. var cfg_css;
  292. var cfg_js;
  293. var cfg_active = (localStorage.getItem('active') === 'true');
  294. function load_settings()
  295. {
  296. cfg_excl = localStorage.getItem('excl') || "";
  297. 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,#deletebutton,.sg-button--s .sg-button__text,.input:checked + .slider,input:focus + .slider,.slider.round,.slider";
  298. cfg_css = localStorage.getItem('css') || "";
  299. 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%; }'
  300. cfg_js = localStorage.getItem('js') || "";
  301.  
  302. window.onload = function geturl(){
  303. var url = document.URL
  304. console.log(url)
  305. if (url="https://brainly.in/"){
  306. cfg_excl = cfg_excl+",.sg-text--break-words"
  307. cfg_css = cfg_css+".sg-text--break-words { word-break: break-word; color: #27eBA7; }"
  308. }}
  309.  
  310. if (typeof GM_getValue !== "undefined")
  311. {
  312. cfg_color = GM_getValue("Color", "#27eBA7");
  313. cfg_bgclr = GM_getValue("bgColor", "#2d4870");
  314. cfg_visclr = GM_getValue("visitedColor", "#a4a4a4");
  315. }
  316. }
  317.  
  318. function activate(yes, prev_active)
  319. {
  320. if(prev_active && el){document.body.removeChild(el);}
  321. if(yes)
  322. {
  323. make_css();
  324. el = GM_addStyle(css);
  325. el = document.body.appendChild(el);
  326. if(cfg_js){eval(cfg_js);}
  327. }
  328. }
  329. document.getElementById ("Checkbox").addEventListener (
  330. "click", toggleDT, false
  331. );
  332.  
  333. function toggleDT()
  334. {
  335. load_settings();
  336. let prev_active = cfg_active;
  337. cfg_active = !(localStorage.getItem('active') === 'true');
  338. activate(cfg_active, prev_active);
  339. if(!cfg_active)
  340. {
  341. localStorage.removeItem('active');
  342. }
  343. else
  344. {
  345. localStorage.setItem('active', "true");
  346. }
  347. }
  348.  
  349. if (typeof GM_registerMenuCommand !== "undefined")
  350. {
  351. GM_registerMenuCommand("Brainly Dark Theme Configuration", cfg, "D");
  352. GM_registerMenuCommand("Toggle Brainly Dark Theme", toggleDT, "T");
  353. }
  354.  
  355. function make_css()
  356. {
  357.  
  358. let exclusions;
  359. let exc_txt = ""
  360. if(cfg_excl !== "")
  361. {
  362. exclusions = cfg_excl.split(",");
  363. for (var i = 0, len = exclusions.length; i < len; i++)
  364. {
  365. exc_txt += ":not("+exclusions[i]+")";
  366. }
  367. }
  368. css = `
  369. *`+exc_txt+` {
  370. color: `+cfg_color+` !important;
  371. background: `+cfg_bgclr+` !important;
  372. border-color: `+cfg_color+` !important;
  373. }
  374. :visited`+exc_txt+`, a:hover`+exc_txt+` {
  375. color: `+cfg_visclr+` !important;
  376. }
  377. `+cfg_css+`
  378. `;
  379. //////////////
  380. }
  381.  
  382. if(cfg_active)
  383. {
  384. load_settings();
  385. make_css();
  386. el = GM_addStyle(css);
  387. document.addEventListener("DOMContentLoaded", function(){ el = document.body.appendChild(el); if(cfg_js){eval(cfg_js);} });
  388. }
  389.  
  390. var t;
  391.  
  392.  
  393.  
  394.  
  395. function cfg()
  396. {
  397. if (typeof GM_setValue !== "undefined")
  398. {
  399. function saveCfg()
  400. {
  401. GM_setValue("Color", document.getElementById("color").value);
  402. GM_setValue("bgColor", document.getElementById("bgclr").value);
  403. GM_setValue("visitedColor", document.getElementById("visitedColor").value);
  404. localStorage.setItem('excl', document.getElementById("excl").value);
  405. localStorage.setItem('css', document.getElementById("css").value);
  406. localStorage.setItem('js', document.getElementById("js").value);
  407. localStorage.setItem('active', document.getElementById("active").checked);
  408. // pretty text "saved"
  409. document.getElementById("cfg_save").value = "SAVED !";
  410. clearTimeout(t);
  411. t = setTimeout(function() {document.getElementById("cfg_save").value = "Save configuration";},1500)
  412. // update active configuration
  413. cfg_color = document.getElementById("color").value;
  414. cfg_bgclr = document.getElementById("bgclr").value;
  415. cfg_visclr = document.getElementById("visitedColor").value;
  416. cfg_excl = document.getElementById("excl").value;
  417. cfg_css = document.getElementById("css").value;
  418. cfg_js = document.getElementById("js").value;
  419. activate(document.getElementById("active").checked, cfg_active );
  420. cfg_active = document.getElementById("active").checked;
  421. // clean up
  422. if(!document.getElementById("active").checked) { localStorage.removeItem('active'); }
  423. if(!document.getElementById("excl").value) { localStorage.removeItem('excl'); }
  424. if(!document.getElementById("css").value) { localStorage.removeItem('css'); }
  425. if(!document.getElementById("js").value) { localStorage.removeItem('js'); }
  426. }
  427. load_settings();
  428. var div = document.createElement("div");
  429. div.style.position = "fixed";
  430. div.style.top = "5%";
  431. div.style.left = "50%";
  432. div.style.margin = "5% -222px";
  433. div.style.width = "444px";
  434. div.style.border = "solid 1px black";
  435. div.style.backgroundColor = cfg_bgclr;
  436. div.style.color = cfg_color;
  437. div.style.zIndex = 8888888;
  438. div.style.lineHeight = 1.0;
  439. div.innerHTML = "<b><center>Configuration</center></b>"
  440. + "<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)"
  441. + "<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"
  442. + "<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"
  443. + "<br><br><center><b>Per-site settings (stored in browser cookies called LocalStorage):</b>"
  444. + "<br><br><input id='active' type='checkbox' style='display:inline; width:initial; padding: initial;'> Enabled for this website"
  445. + "<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>"
  446. + "<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>"
  447. + "<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>"
  448. + "<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>";
  449. document.body.appendChild(div);
  450. document.getElementById("color").value = cfg_color;
  451. document.getElementById("bgclr").value = cfg_bgclr;
  452. document.getElementById("visitedColor").value = cfg_visclr;
  453. //
  454. document.getElementById("active").checked = cfg_active;
  455. document.getElementById("excl").value = cfg_excl;
  456. document.getElementById("css").value = cfg_css;
  457. document.getElementById("js").value = cfg_js;
  458. document.getElementById("cfg_save").addEventListener("click", saveCfg, true);
  459. document.getElementById("cfg_close").addEventListener("click", function(){div.remove();clearTimeout(t);}, true);
  460. }
  461. else
  462. {
  463. alert("Sorry, Chrome userscripts in native mode can't have configurations! Install TamperMonkey userscript-manager extension");
  464. }
  465. }
  466.  
  467. }();
  468.  
  469.  
  470.  
  471.