CustomChat v2 by Sharke ! Noel

enter something useful

  1. // ==UserScript==
  2. // @name CustomChat v2 by Sharke ! Noel
  3. // @namespace http://worldaide.fr/*
  4. // @version 1.1
  5. // @description enter something useful
  6. // @author Sharke
  7. // @match http://worldaide.fr/*
  8. // @grant none
  9. // ==/UserScript==
  10. // CustomChat v2 by Wayz !
  11. // There is a copyright on this script. Do not change it, thank's.
  12. var scc = {
  13. color: "#CE0C26",
  14. notif: true,
  15. bot: false,
  16. lastRP: Date.now(),
  17. lastH: 0
  18. };
  19. var rP = {
  20. rep1: {title:"",msg:""},
  21. rep2: {title:"",msg:""},
  22. rep3: {title:"",msg:""},
  23. rep4: {title:"",msg:""},
  24. rep5: {title:"",msg:""}
  25. };
  26. var customChat = {
  27. msgID: [],
  28. __msgID: [],
  29. username: $('.accountUsername').text(),
  30. template_Button: '<div id="customChat_op" style="font-style:none;float:right;cursor:pointer;" class="fa fa-bars"></div>',
  31. template_Html: '<div id="customChat_op" data-role="blk" style="width:100%;height:100%;position:fixed;z-index:2147483645;background-color:rgba(0,0,0,0.2);opacity:0;display:none;"></div><div style="right: -800px;position: fixed;" class="customChat"><div class="customChat_header" style="background-color:#ce0c26"><div class="customChat_close" style="background-image:url()"></div><div class="customChat_header_text" style="margin-top: 40px;">CustomChat</div><div class="customChat_header_message">by Wayz</div></div><div class="customChat_middle_wrapper"><div class="customChat_middle"><div><input class="customChat_btn" id="hello" type="button"/><label for="hello"> Hello ! </label></div><br/><div><input class="customChat_btn" id="rep_pred" type="button"/><label for="rep_pred"> Message prédéfini </label></div><br/><div><input class="customChat_cb" id="notif" type="checkbox" checked=""/><label for="notif"><span class="ui"></span> Activer les notifications </label></div><br/><br/><div><input class="customChat_cb" id="bot" type="checkbox"/><label for="bot"><span class="ui"></span> Activer le pseudo BOT </label></div></div></div></div><div class="customChat_reponse" style="right:-800px;"><div class="customChat_rep_wrapper"><ul class="customChat_pred"><li class="customChat_a"><a id="customChat_rP" data-msg="" data-num="1" href="javascript:void(0);">Message 1</a></li><li class="customChat_a"><a id="customChat_rP" data-msg="" data-num="2" href="javascript:void(0);">Message 2</a></li><li class="customChat_a"><a id="customChat_rP" data-msg="" data-num="3" href="javascript:void(0);">Message 3</a></li><li class="customChat_a"><a id="customChat_rP" data-msg="" data-num="4" href="javascript:void(0);">Message 4</a></li><li class="customChat_a"><a id="customChat_rP" data-msg="" data-num="5" href="javascript:void(0);">Message 5</a></li><li class="customChat_a"><a id="customChat_del-rP" href="javascript:void(0);">Supprimer un message</a></li><li class="customChat_a"><a id="customChat_timer-rP" href="javascript:void(0);">Dernier message envoyé il y a NaN</a></li></ul></div></div>',
  32. template_Css: "<style id=\"css_cc\">.customChat{position:fixed;width:300px;height:100%;right:-420px;top:0;color:#000;z-index:2147483647;font-family:myriad-pro,sans-serif;text-align:left;line-height:1.2;user-select:none!important;-khtml-user-select:none!important;-o-user-select:none!important;-moz-user-select:-moz-none!important;-webkit-user-select:none!important;-webkit-transition:all .35s linear;-moz-transition:all .35s linear;-o-transition:all .35s linear;transition:all .35s linear}.customChat .customChat_header{position:absolute;height:230px;width:240px;padding:0 30px;top:0;left:0;overflow:hidden;border-left:1px solid rgba(0,0,0,.2);box-sizing:content-box}.customChat .customChat_header .customChat_header_text{width:100%;height:35px;padding-top:15px;text-align:center;color:#fff;font-family:\"Source Sans Pro\",sans-serif;font-size:25px;font-weight:lighter}.customChat .customChat_header .customChat_header_message{text-align:center;color:#fff;font-family:\"Source Sans Pro\",sans-serif;font-size:13px;font-weight:lighter}.customChat .customChat_middle_wrapper{height:auto;top:230px;bottom:0;width:100%;position:absolute;z-index:-2;border-left:1px solid rgba(0,0,0,.2);background-color:rgb(245,245,245)}.customChat>.customChat_middle_wrapper>.customChat_middle{background-color:#fff;position:absolute;top:0;left:0;width:100%;padding:10%;border-bottom:1px solid #dfdfdf;box-sizing:border-box;overflow:auto;max-height:100%}.customChat_pred{list-style:none;padding:4px;margin:0;background:#FEFEFE}.customChat_a a{display:block;margin:1px 0;padding:8px 20px;color:#34495E;background:#FFF;text-decoration:none;-webkit-transition:all .3s;-moz-transition:all .3s;transition:all .3s}.customChat_a a:focus,.customChat_a a:hover{background:#CE0C26;color:#FFF;padding-left:25px}.customChat_reponse{position:fixed;width:600px;height:100%;right:0px;top:0;color:#000;z-index:2147483646;font-family:myriad-pro,sans-serif;text-align:left;line-height:1.2;user-select:none!important;-khtml-user-select:none!important;-o-user-select:none!important;-moz-user-select:-moz-none!important;-webkit-user-select:none!important;-webkit-transition:all .35s linear;-moz-transition:all .35s linear;-o-transition:all .35s linear;transition:all .35s linear;margin-top:229px;}.customChat_rep_wrapper{background-color:#fff;position:absolute;top:0;left:0;width:100%;border:1px solid #dfdfdf;box-sizing:border-box;overflow:auto;max-height:50%;max-width:100%}.customChat_cb[type=checkbox]:checked,.customChat_cb[type=checkbox]:not(:checked){position:absolute;left:-9999px}.customChat_cb[type=checkbox]:checked+label,.customChat_cb[type=checkbox]:not(:checked)+label{position:relative;padding-left:75px;cursor:pointer}.customChat_cb[type=checkbox]:checked+label:after,.customChat_cb[type=checkbox]:checked+label:before,.customChat_cb[type=checkbox]:not(:checked)+label:after,.customChat_cb[type=checkbox]:not(:checked)+label:before{content:'';position:absolute}.customChat_cb[type=checkbox]:checked+label:before,.customChat_cb[type=checkbox]:not(:checked)+label:before{left:0;top:-3px;width:65px;height:30px;background:#DDD;border-radius:15px;-webkit-transition:background-color .2s;-moz-transition:background-color .2s;-ms-transition:background-color .2s;transition:background-color .2s}.customChat_cb[type=checkbox]:checked+label:after,.customChat_cb[type=checkbox]:not(:checked)+label:after{width:20px;height:20px;-webkit-transition:all .2s;-moz-transition:all .2s;-ms-transition:all .2s;transition:all .2s;border-radius:50%;background:#7F8C9A;top:2px;left:5px}.customChat_cb[type=checkbox]:checked+label:before{background:#34495E}.customChat_cb[type=checkbox]:checked+label:after{background:#CE0C26;top:2px;left:40px}.customChat_cb[type=checkbox]:checked+label .ui,.customChat_cb[type=checkbox]:checked+label .ui:after,.customChat_cb[type=checkbox]:not(:checked)+label .ui:before{position:absolute;left:6px;width:65px;border-radius:15px;font-size:14px;font-weight:700;line-height:22px;-webkit-transition:all .2s;-moz-transition:all .2s;-ms-transition:all .2s;transition:all .2s}.customChat_cb[type=checkbox]:not(:checked)+label .ui:before{content:'Non';left:32px}.customChat_cb[type=checkbox]:checked+label .ui:after{content:'Oui';color:#CE0C26}.customChat_btn[type=button]{background-color:#CE0C26;border-radius:15px;border:5px solid #34495E;width:65px;height:30px;cursor:pointer;margin-right:5px;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s}label{color:#34495E}.customChat_btn[type=button]:hover{background-color:#C94D4D}</style>", // base checkbox by @geoffrey_crofte
  33. template_Js: '<script id="js_cc">$("#rep_pred").click(function(){var s=$(".customChat_reponse");s.hasClass("visible")?($(this).css("backgroundColor","#6AD2EF"),s.animate({right:"-1000px"},200).removeClass("visible")):(s.animate({right:"0px"},200).addClass("visible"),$(this).css("backgroundColor","#C94D4D"))}),$("div#customChat_op").click(function(){var s=$(".customChat"),a=$(".customChat_reponse"), z=$("#modal_js");s.hasClass("visible")?(s.animate({right:"-1000px"},200).removeClass("visible"),a.animate({right:"-1000px"},200).removeClass("visible"),z.css("display", "none"),$("#rep_pred").css("backgroundColor","#6AD2EF"),$(\'div#customChat_op[data-role="blk"]\').animate({opacity:"0"},200,"swing",function(){$(\'div#customChat_op[data-role="blk"]\').css("display","none")})):(s.animate({right:"0px"},200).addClass("visible"),$(\'div#customChat_op[data-role="blk"]\').animate({opacity:"1"},200,"swing",function(){$(\'div#customChat_op[data-role="blk"]\').css("display","block")}))});</script>',
  34. template_M: '<div id="modal_js" style="display:none;width:600px;background-color:#fefefe;border:1px solid rgba(0, 0, 0, 0.2);border-radius:5px;-webkit-box-shadow: 0px 0px 15px rgba(0,0,0,0.3);-moz-box-shadow: 0px 0px 15px rgba(0,0,0,0.3);box-shadow: 0px 0px 15px rgba(0,0,0,0.3);z-index:9854136598742"><div id="modal_js_head" style="border-bottom:1px solid rgba(0, 0, 0, 0.2);padding:10px 15px 10px 15px;"></div><div id="modal_js_body" style="padding:15px;"></div><div id="modal_js_footer" style="border-top:1px solid rgba(0, 0, 0, 0.2);padding:10px 15px 25px 15px;text-align:right;"><input type="button" id="modal_js_cancel" class="button primary" value="Annuler" /><input type="button" id="modal_js_save" class="button" value="Sauvegarder" /></div></div>',
  35. init: function(){
  36. if(location.host == "dreamgaming.fr"){
  37. alert('PLA-PLA-PLAGIEUR');
  38. return location.href = "http://realitygaming.fr";
  39. }
  40. setInterval(function(){customChat.checkNewMsg();}, 250);
  41. if(location.pathname.indexOf('chatbox') != -1) {
  42. $('#taigachat_controls').append(this.template_Button);
  43. $('#customChat_op.fa.fa-bars').attr('style', 'font-style:none;float:right;cursor:pointer;font-size:24px;padding-right:10px;');
  44. }
  45. else {
  46. $('#taigachat_full').find('.nodeTitle').append(this.template_Button);
  47. }
  48. $('body').prepend(this.template_Html);
  49. $('body').prepend(this.template_Css);
  50. $('body').prepend(this.template_Js);
  51. $('body').prepend(this.template_M);
  52. var $notif = $('#notif[type=checkbox]');
  53. $notif.on('change', function(){
  54. scc.notif = $(this).is(':checked');
  55. customChat.save();
  56. });
  57. var $bot = $('#bot[type=checkbox]');
  58. $bot.on('change', function(){
  59. scc.bot = $(this).is(':checked');
  60. customChat.save();
  61. });
  62. var $hello = $('#hello[type=button]');
  63. $hello.on('click', function() {
  64. customChat.hello();
  65. customChat.save();
  66. });
  67. var $rep = $('a#customChat_rP');
  68. $rep.on('click', function(){
  69. if($(this).data('msg').length > 4) {
  70. scc.lastRP = Date.now();
  71. var $input = $('#taigachat_message');
  72. $input.val(($input.val().trim().length>1?$input.val().trim()+" ":"") + customChat.decode_b64($(this).data('msg')));
  73. customChat.save();
  74. }
  75. else {
  76. customChat.add_rP($(this));
  77. }
  78. });
  79. var $rep_del = $('a#customChat_del-rP');
  80. $rep_del.on('click', function(){
  81. customChat.del_rP();
  82. });
  83. (function($){
  84. $.fn.extend({
  85. center: function () {
  86. return this.each(function() {
  87. var top = ($(window).height() - $(this).outerHeight()) / 2;
  88. var left = ($(window).width() - $(this).outerWidth()) / 2;
  89. $(this).css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'});
  90. });
  91. }
  92. });
  93. })(jQuery);
  94. this.load();
  95. },
  96. encode_b64: function(str) {
  97. return window.btoa(encodeURIComponent(escape(str)));
  98. },
  99. decode_b64: function(str) {
  100. return unescape(decodeURIComponent(window.atob(str)));
  101. },
  102. save: function(){
  103. var settings_scc = JSON.stringify(scc);
  104. var settings_rP = JSON.stringify(rP);
  105. localStorage.setItem('settings_scc', settings_scc);
  106. localStorage.setItem('settings_rP', settings_rP);
  107. },
  108. load: function(){
  109. var a = localStorage.getItem("settings_scc");
  110. if(a){
  111. var b = Object.keys(scc);
  112. var c = JSON.parse(a);
  113. for(var i in b){
  114. if(c[b[i]] == undefined){
  115. this.save();
  116. }
  117. else {
  118. scc[b[i]] = c[b[i]];
  119. }
  120. }
  121. }
  122. else {
  123. this.save();
  124. }
  125. var z = localStorage.getItem("settings_rP");
  126. if(z){
  127. var b = Object.keys(rP);
  128. var c = JSON.parse(z);
  129. for(var i in b){
  130. if(c[b[i]] == undefined){
  131. this.save();
  132. }
  133. else {
  134. rP[b[i]] = c[b[i]];
  135. }
  136. }
  137. }
  138. else {
  139. this.save();
  140. }
  141. for(var i in rP){
  142. if(rP[i].title.length > 1 && rP[i].msg.length > 1){
  143. var num = i.substr(3);
  144. $('#customChat_rP[data-num="' + num + '"]').text(customChat.decode_b64(rP[i].title));
  145. $('#customChat_rP[data-num="' + num + '"]').data('msg', rP[i].msg);
  146. }
  147. }
  148. $('#notif[type=checkbox]').prop('checked', scc.notif);
  149. $('#bot[type=checkbox]').prop('checked', scc.bot);
  150. setInterval(function(){customChat.lastRP();}, 2000);
  151. },
  152. notify: function(msg) {
  153. if(scc.notif){
  154. if(!("Notification"in window)){console.error("Ce navigateur ne supporte pas les notifications !")}else if(Notification.permission==="granted"){var notification=new Notification(msg, {icon: 'http://i.imgur.com/UTnwcjK.png'})}else if(Notification.permission!=="denied"){Notification.requestPermission(function(e){if(!("permission"in Notification)){Notification.permission=e}if(e==="granted"){var t=new Notification(msg, {icon: 'http://realitygaming.fr/attachments/rg-png.14121/'})}})}
  155. }
  156. else {
  157. console.log('notif disable')
  158. }
  159. },
  160. checkNewMsg: function(){
  161. var msg = $('#taigachat_box').children('ol').children('li');
  162. for(var i in msg) {
  163. var id = msg.eq(i).data('messageid');
  164. var msg_text = $('#taigachat_box').children('ol').children('li[data-messageid="' + id + '"]').children('span').eq(1).children('div').text().trim();
  165. var msg_sender = $('#taigachat_box').children('ol').children('li[data-messageid="' + id + '"]').children('span').eq(1).children('a').text().trim();
  166. if(this.msgID.indexOf(id) == -1 && msg_text.indexOf(this.username) != -1) {
  167. this.msgID.unshift(id);
  168. this.newMsg(id);
  169. }
  170. else if(this.__msgID.indexOf(id) == -1 && msg_sender == this.username && scc.bot){
  171. $('#taigachat_box').children('ol').children('li[data-messageid="' + id + '"]').children('span').eq(1).children('a').children('span').attr('class', 'style10');
  172. this.__msgID.unshift(id);
  173. }
  174. }
  175. },
  176. newMsg: function(id) {
  177. $('#taigachat_box').children('ol').children('li[data-messageid="' + id + '"]').css('backgroundColor', "rgba(179, 32, 32, 0.219608)");
  178. var msg = $('#taigachat_box').children('ol').children('li[data-messageid="' + id + '"]').children('span').eq(1).children('div').text().trim();
  179. var sender = $('#taigachat_box').children('ol').children('li[data-messageid="' + id + '"]').children('span').eq(1).children('a').text().trim();
  180. this.notify(sender + " - " + msg);
  181. },
  182. hello: function() {
  183. if((Date.now() - scc.lastH) >= 3600000){
  184. scc.lastH = Date.now();
  185. var user1 = $('#taigachat_box').children('ol').children('li').eq(5).children('span').eq(1).children('a').text();
  186. var user2 = $('#taigachat_box').children('ol').children('li').eq(17).children('span').eq(1).children('a').text();
  187. var user3 = $('#taigachat_box').children('ol').children('li').eq(23).children('span').eq(1).children('a').text();
  188. var userinchat = $('#taigachat_count').text();
  189. $("#taigachat_message").val("Salut à @" + user1 + " , @" + user2 + " , @" + user3 + " et aux " + userinchat + " membres actuellement sur le chat :)");
  190. this.save();
  191. }
  192. else{
  193. alert('Vous avez utilisé cette fonction il y a moins d\'un heure !');
  194. }
  195. },
  196. lastRP: function(){
  197. var ms = Date.now() - scc.lastRP,
  198. // http://stackoverflow.com/a/19700358
  199. seconds = parseInt((ms/1000)%60),
  200. minutes = parseInt((ms/(1000*60))%60),
  201. hours = parseInt((ms/(1000*60*60))%24);
  202.  
  203. hours = (hours < 10) ? "0" + hours : hours;
  204. minutes = (minutes < 10) ? "0" + minutes : minutes;
  205. seconds = (seconds < 10) ? "0" + seconds : seconds;
  206.  
  207. var time = hours + ":" + minutes + ":" + seconds;
  208. $('#customChat_timer-rP').text('Dernier message envoyé il y a ' + time);
  209. },
  210. modal: function(title, body){
  211. $('#modal_js').css('display', 'block');
  212. $('#modal_js').center();
  213. $('#modal_js_head').html('<h2 style="font-family: \'Open Sans Condensed\',\'Arial\',sans-serif; font-size: 12pt; color: rgb(52, 73, 94);">' + title + '</h2>');
  214. $('#modal_js_body').html(body);
  215. },
  216. add_rP: function($rep){
  217. this.modal('Ajouter une réponse', '<input id="modal_js_rep_title" class="textCtrl" style="width:100%;height:20px;" placeholder="Entrez le titre du message" /><br/><br/><input id="modal_js_rep_body" class="textCtrl" style="width:100%;height:20px;" placeholder="Entrez le contenu du message" />');
  218. var is_add = true;
  219. $('#modal_js_save').on('click', function(){
  220. if(is_add){
  221. var rep_msg = $('#modal_js_rep_body').val().trim();
  222. var rep_title = $('#modal_js_rep_title').val().trim();
  223. if(rep_title.length > 2) {
  224. if(rep_msg.length > 4) {
  225. var cR = $rep.data('num');
  226. rP['rep' + cR].title = customChat.encode_b64(rep_title);
  227. rP['rep' + cR].msg = customChat.encode_b64(rep_msg);
  228. $('#modal_js').css('display', 'none');
  229. $rep.text(rep_title);
  230. $rep.data('msg', customChat.encode_b64(rep_msg));
  231. customChat.save();
  232. is_add = false;
  233. }
  234. else {
  235. alert('Votre message n\'est pas assez long !');
  236. }
  237. }
  238. else {
  239. alert('Votre titre n\'est pas assez long !');
  240. }
  241. }
  242. });
  243. $('#modal_js_cancel').on('click', function(){
  244. if(is_add){
  245. $('#modal_js').css('display', 'none');
  246. is_add = false;
  247. }
  248. });
  249. },
  250. del_rP: function(){
  251. this.modal('Entrer le chiffre de la réponse à supprimer', '<input id="modal_js_rep_num" class="textCtrl" style="width:100%;height:20px;" placeholder="Chiffre de la réponse à supprimer" /><br/>');
  252. var is_del = true;
  253. $('#modal_js_save').on('click', function(){
  254. if(is_del){
  255. var rep_num = $('#modal_js_rep_num').val().trim();
  256. if(rep_num > 0 && rep_num < 6){
  257. $('#customChat_rP[data-num="' + rep_num + '"]').text("Message " + rep_num);
  258. $('#customChat_rP[data-num="' + rep_num + '"]').data('msg', "");
  259. rP['rep' + rep_num].title = "";
  260. rP['rep' + rep_num].msg = "";
  261. $('#modal_js').css('display', 'none');
  262. customChat.save();
  263. is_del = false;
  264. }
  265. }
  266. });
  267. $('#modal_js_cancel').on('click', function(){
  268. if(is_del){
  269. $('#modal_js').css('display', 'none');
  270. is_del = false;
  271. }
  272. });
  273. }
  274. };
  275.  
  276. customChat.init();

QingJ © 2025

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