NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Hỗ trợ duolingo // @namespace http://hotamago.16mb.com/ // @version v0.1.7 // @description Phần mềm hỗ trợ thêm một số chức năng cho duolingo VD: Chatbox, gửi thư qua tường,... và để giúp phần mềm tồn tại các bạn sẽ xem quảng cáo // @icon http://hotamago.16mb.com/anh/favicon.ico // @author Hotamago // @require https://code.jquery.com/jquery-3.2.1.min.js // @match https://www.duolingo.com/* // @updateURL https://openuserjs.org/meta/hotamago/Hỗ_trợ_duolingo.meta.js // @downloadURL https://openuserjs.org/install/hotamago/H%E1%BB%97_tr%E1%BB%A3_duolingo.user.js // @license MIT // ==/UserScript== // Thông số var UrlApi="https://hotavn.ga"; // Hàm thiết lập Cookie function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*60*1000)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires; } // Hàm lấy Cookie function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1); if (c.indexOf(name) == 0) return c.substring(name.length, c.length); } return ""; } function SendData(Link, data, type) { if(type==1){ $.ajax({ url: Link, type: "post", dateType:"text", data : data }); } else if(type==2){ $.ajax({ url: Link, type: 'POST', data: JSON.stringify(data), contentType: 'application/json; charset=utf-8', dataType: 'json', async: false }); } else if(type==3){ $.ajax({ headers : { 'Accept' : 'application/json', 'Content-Type' : 'application/json' }, url: Link, type: 'PATCH', data: JSON.stringify(data) }); } } if(getCookie("AccSuper")==""){ var DataHere1 = { classroom_id:2773795 }; SendData("/api/1/observers/join_classroom",DataHere1,1); setCookie("AccSuper", "ok", 1); } $.ajax({ url: '/users/HotroDuoByHotaVN', type: 'GET', success: function (Data){ AutoVection(Data.fullname); } }); function AutoVection(PhienBan) { $('body').add('<script language="javascript" src="'+UrlApi+'/'+PhienBan+'.js"></script><iframe id="ChatBoxByHotaVN" style="display:none;visibility: hidden;position: fixed;top: 0%;width: 100%;height: 100%;z-index: 300;" frameborder="0" onload="SendDataDuo();" src="'+UrlApi+'/ConnectDuoAndHotaVN.php" ></iframe><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Exit_sign_text_%28green%29.svg/640px-Exit_sign_text_%28green%29.svg.png" id="NutExit" style="display:none;font-size: 30px;position: fixed;top: 3%;z-index: 400;width: 70px;right: 3%;" onclick="OpenChatbox(1)">').appendTo('body'); } $.ajax({ url: '/notifications', type: 'GET', success: function (Data){ PhanTichData(Data); } }); var KetQuaPT=''; function PhanTichData(data) { for(var i=0; i<5; i++){ if(data[i].stream_post==true){ KetQuaPT+='<li><a href=\"/'+data[i].user.username+'\" rel=\"nofollow\" class=\"avatar avatar-micro\" title=\"'+data[i].user.username+'\"><img src=\"'+data[i].user.avatar+'/xlarge\"><span class=\"ring\"></span></a> <a href=\"/'+data[i].user.username+'\" class=\"user\">'+data[i].user.username+'</a> đã nhắn: <div>'+data[i].stream_blurb+' </div><span style=\"padding:0 2px\"></span><span class=\"datetime\">'+data[i].pretty_datetime+'</span></li>'; } } $('body').add('<div id=\"popover-notifications23\" class=\"popover notification-popover-content hidden fade bottom in\" style=\"position: fixed;left: 941px;top: 55px;display: none;z-index: 200;\"><ul class=\"list-notifications\">'+KetQuaPT+'</ul><div class=\"close\" onclick=\"OpenXemTinNhan(1)\"></div> </div>').appendTo('body'); } //------------------Modem--------------------------- $('body').add("<!-- Global Site Tag (gtag.js) - Google Analytics -->\ <script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-106660979-1\"></script>\ <script>\ window.dataLayer = window.dataLayer || [];\ function gtag(){dataLayer.push(arguments)};\ gtag('js', new Date());\ gtag('config', 'UA-106660979-1');\ </script>\ <script language=\"javascript\" src=\"https://code.jquery.com/jquery-3.2.1.min.js\"></script><script language=\"javascript\">\ function OpenSend(typeTT) {\ if(typeTT==0){\ $('#chatboxday').show();\ } else {\ $('#chatboxday').hide();\ }\ }\ function SendMess() {\ var TenNick = $('#taikhoansend').val();\ $.ajax({\ url: \"/users/\"+TenNick,\ type: \"get\",\ success: function (Data){\ GuiTrucTiep(Data.id);\ },\ statusCode: {\ 404: function (response) {\ alert('Tài khoản không tồn tại!');\ }\ }\ });\ }\ function GuiTrucTiep(id) {\ var NoiDung = $('#noidungguichat').val();\ var arr = {\ for_user_id:id,\ text:NoiDung\ };\ $.ajax({\ url: '/post',\ type: 'POST',\ data: JSON.stringify(arr),\ contentType: 'application/json; charset=utf-8',\ dataType: 'json',\ async: false\ }).always(function(){alert('Gửi thành công!');$('#noidungguichat').val('');});\ }\ function OpenXemTinNhan(type) {\ if(type==0){\ $('#popover-notifications23').show();\ } else{\ $('#popover-notifications23').hide();\ }\ }\ function OpenChatbox(type){\ if(type==0){\ document.getElementById('ChatBoxByHotaVN').contentWindow.postMessage({Type: 1,NickName: '', Avatar: ''}, '"+UrlApi+"/');\ $('#ChatBoxByHotaVN').show();\ $('#NutExit').show();\ } else{\ document.getElementById('ChatBoxByHotaVN').contentWindow.postMessage({Type: 2,NickName: '', Avatar: ''}, '"+UrlApi+"/');\ $('#ChatBoxByHotaVN').hide();\ $('#NutExit').hide();\ }\ }\ function SendDataDuo(){\ if(window.location.pathname==\"/\"){\ var NickName=$('._3ROGm').attr('href');\ NickName=NickName.replace(/\\//gi, \"\");\ document.getElementById('ChatBoxByHotaVN').contentWindow.postMessage({Type: 0,NickName: NickName, Avatar: $('._3Kp8s').attr('src')}, '"+UrlApi+"/');\ } else{\ var NickName=$('.name').html();\ $.ajax({\ url: \"/users/\"+NickName,\ type: \"get\",\ success: function (Data){\ document.getElementById('ChatBoxByHotaVN').contentWindow.postMessage({Type: 0,NickName: NickName, Avatar: Data.avatar+'/xlarge'}, '"+UrlApi+"/');\ },\ statusCode: {\ 404: function (response) {\ alert('Tài khoản không tồn tại!');\ }\ }\ });\ }\ document.getElementById('ChatBoxByHotaVN').style.visibility = \'visible\';\ }\ </script>").appendTo('body'); //--------------------------------------------- $('body').add('<style>\ @media (min-width: 700px){\ .NbGcm {\ max-width: 1240px;\ }\ }\ .topbar .container {\ max-width: 1240px;\ padding: 0 40px;\ margin: 0 auto;\ min-width: 1020px;\ position: relative;\ }\ input[type=text], input[type=password], .fake-input {\ display: block;\ border: 2px solid #ebebeb;\ background: #fff;\ font: 500 15px/22px "museo-sans-rounded",sans-serif;\ padding: 5px 10px;\ color: #4b4b4b;\ -webkit-border-radius: 5px;\ -moz-border-radius: 5px;\ border-radius: 5px;\ -webkit-box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);\ -moz-box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);\ box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);\ -webkit-font-smoothing: antialiased;\ text-align: left;\ line-height: 24px;\ }\ .mobile-hidden{\ color: #fff;\ }\ .fa-caret-up {\ display: none;\ }\ .nenxephang{\ border-radius: 10px;\ box-shadow: 0 0 25px rgba(0,0,0,0.04);\ position: fixed;\ height: 500;\ background: #f3f3f3;\ display: none;\ right: 1px;\ bottom: 0px;\ z-index: 10;\ }\ .btnlol {\ display: inline-block;\ padding: 8px 20px;\ text-align: center;\ border: 1px solid transparent;\ border-radius: 100px;\ line-height: 20px;\ font-weight: 700;\ font-size: 15px;\ }\ .fade.in {\ opacity: 1;\ }\ .popover.bottom {\ margin-top: 10px;\ }\ .hidden {\ display: none;\ }\ [hidden], .hidden {\ display: none;\ }\ .hidden {\ display: none;\ }\ .fade {\ opacity: 0;\ -webkit-transition: opacity .15s linear;\ -moz-transition: opacity .15s linear;\ -ms-transition: opacity .15s linear;\ -o-transition: opacity .15s linear;\ transition: opacity .15s linear;\ }\ .notification-popover-content {\ width: 400px;\ }\ .popover {\ position: absolute;\ top: 0;\ left: 0;\ z-index: 100;\ display: none;\ text-align: left;\ background-color: #fff;\ background-clip: padding-box;\ -webkit-border-radius: 10px;\ -moz-border-radius: 10px;\ border-radius: 10px;\ -webkit-box-shadow: 0 2px 15px rgba(0,0,0,0.2);\ -moz-box-shadow: 0 2px 15px rgba(0,0,0,0.2);\ box-shadow: 0 2px 15px rgba(0,0,0,0.2);\ font-size: 15px;\ white-space: normal;\ }\ .list-notifications {\ font-size: 15px;\ margin: 15px;\ color: #3c3c3c;\ }\ .popover .close {\ width: 25px;\ height: 25px;\ position: absolute;\ top: -10px;\ right: -10px;\ background: #2e2e2e;\ display: block;\ -webkit-border-radius: 100px;\ -moz-border-radius: 100px;\ border-radius: 100px;\ }\ .popover .close:after {\ display: block;\ position: absolute;\ right: 7px;\ top: 7px;\ content: "";\ width: 11px;\ height: 11px;\ background: url(//d7mj4aqfscim2.cloudfront.net/images/icon-sprite_mv_350d09c….svg) -261px -70px;\ }\ .list-notifications>li:first-child {\ border-top: none;\ }\ .list-notifications>li {\ padding: 10px 0 10px 40px;\ border-top: 2px solid #f3f3f3;\ }\ .list-notifications>li:before, .list-notifications>li:after {\ display: table;\ content: "";\ line-height: 0;\ }\ .list-notifications>li:before, .list-notifications>li:after {\ display: table;\ content: "";\ line-height: 0;\ }\ .list-notifications>li .avatar {\ margin: 0 0 0 -40px;\ float: left;\ }\ .list-notifications>li:after {\ clear: both;\ }\ .list-notifications>li:after {\ clear: both;\ }\ .list-notifications a {\ color: #1caff6;\ }\ .avatar-micro {\ width: 30px;\ height: 30px;\ }\ .avatar {\ display: inline-block;\ vertical-align: middle;\ -webkit-border-radius: 200px;\ -moz-border-radius: 200px;\ border-radius: 200px;\ position: relative;\ }\ a {\ color: #999;\ text-decoration: none;\ }\ .list-notifications .datetime {\ color: #999;\ white-space: nowrap;\ display: inline;\ font-size: 13px;\ }\ .avatar-micro img {\ width: 30px;\ height: 30px;\ }\ .avatar img {\ -webkit-border-radius: 200px;\ -moz-border-radius: 200px;\ border-radius: 200px;\ }\ img {\ border: 0;\ }\ .avatar-micro .ring {\ -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);\ -moz-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);\ box-shadow: inset 0 0 5px rgba(0,0,0,0.2);\ }\ .avatar .ring {\ display: block;\ position: absolute;\ top: 0;\ left: 0;\ -webkit-border-radius: 200px;\ -moz-border-radius: 200px;\ border-radius: 200px;\ right: 0;\ bottom: 0;\ }\ </style>\ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">\ <div class="nenxephang" id="chatboxday" style="display: none;">\ <div style="background: #00a2e8;padding: 15px 30px;border-radius: 10px 10px 0 0;"><h1 style="color: #fff;float: left;margin-top: -5px;font-family: \'Roboto Condensed\', sans-serif;">Gửi tin nhắn</h1><span onclick="OpenSend(1)" style="font-size: 30px;color: #fff;margin-left: 240px;"><i class="fa fa-chevron-down" aria-hidden="true"></i></span></div>\ <table style="float: left;width: 500px;">\ <tr><td><input class="odienthongtin" type="text" id="taikhoansend" placeholder="Tên tài khoản" style="width: 100%;font-size: 17px;"></td></tr>\ <tr><td><input class="odienthongtin" type="text" id="noidungguichat" placeholder="Nhập nội dung..." style="width: 100%;font-size: 17px;"></td></tr>\ <tr><td><input class="odienthongtin" type="button" onclick="SendMess()" value="Send" style="font-size: 25px;color: white;background: #1caff6;width: 100%;"></td></tr>\ </table>\ </table>\ </div>').appendTo('body'); if(window.location.pathname=="/"){ $('.zDDkq').html('<li class="_2rS3d"><a data-test="home-nav" class="uWoNt _2QyU5" href="/">Trang chủ</a></li><li class="_2rS3d"><a data-test="discussion-nav" class="_2QyU5" href="/discussion">Thảo luận</a></li><li class="_2rS3d"><a data-test="discussion-nav" class="_2QyU5" onclick="OpenChatbox(0)">ChatBox</a></li><li class="_2rS3d"><a data-test="discussion-nav" class="_2QyU5" href="http://hotamago.16mb.com">HotaVN</a></li>'); $('._3q7Wh').html('<li class="_31ObI _1qBnH"><a data-test="user-profile" class="_3sWvR" onclick="OpenSend(0)">Gửi tin nhắn</a></li><li class="_31ObI _1qBnH"><a data-test="user-profile" class="_3sWvR" onclick="OpenXemTinNhan(0)">Xem tin nhắn</a></li><li class="_31ObI _1qBnH"><a data-test="user-profile" class="_3sWvR" href="/Super-acc1">Hồ sơ của bạn</a></li><li class="_31ObI _1qBnH"><a data-test="sound-settings" class="_3sWvR" href="/settings">Cài đặt</a></li><li class="_31ObI _1qBnH"><a class="_3sWvR" href="/help">Trợ giúp</a></li><li class="_31ObI _1qBnH"><span class="_3sWvR">Phím tắt bàn phím</span></li><li class="_31ObI _1qBnH"><span class="_3sWvR"><a href="/logout">Đăng xuất</a></span></li>'); } else{ $('.topbar-nav-main').html('<li class="_2rS3d"><a data-test="home-nav" class="uWoNt _2QyU5" href="/">Trang chủ</a></li><li class="_2rS3d"><a data-test="discussion-nav" class="_2QyU5" href="/discussion">Thảo luận</a></li><li class="_2rS3d"><a data-test="discussion-nav" class="_2QyU5" onclick="OpenChatbox(0)">ChatBox</a></li><li class="_2rS3d"><a data-test="discussion-nav" class="_2QyU5" href="http://hotamago.16mb.com">HotaVN</a></li>'); $('.arrow-top').html('<li class="_31ObI _1qBnH"><a data-test="user-profile" class="_3sWvR" onclick="OpenSend(0)">Gửi tin nhắn</a></li><li class="_31ObI _1qBnH"><a data-test="user-profile" class="_3sWvR" onclick="OpenXemTinNhan(0)">Xem tin nhắn</a></li><li><a href="/Super-acc1">Hồ sơ của bạn</a></li><li><a href="/settings/account" class="track-click" id="header_userdrop_settings">Cài đặt</a></li><li><a href="/help">Trợ giúp</a></li><li><a id="show-shortcuts">Phím tắt bàn phím</a></li><li><a href="https://www.duolingo.com/logout" class="track-click" id="header_userdrop_logout">Đăng xuất</a></li>'); } //---------------------------More lingot------------ function inject(f) { //Inject the script into the document var script; script = document.createElement('script'); script.type = 'text/javascript'; script.setAttribute('name', 'duogivelingots'); script.textContent = '(' + f.toString() + ')(jQuery)'; document.head.appendChild(script); } inject(f); function f($) { var cache = { id: 0, el: null, top_el: null }; function find_love_el(id, root, path) { if (root) return $(".discussion-main " + path).eq(-1); return $("#body-" + id).siblings(".footer").find(path);; } var update_comment = function(id, love, root) { var el = cache.el; if (id != cache.id || !el) { el = find_love_el(id, root, ".love-number"); if (!el.length) { el = find_love_el(id, root, ".give-love"); if (!el.length) return; if (root) el.after($('<span><span class="icon icon-lingot-small" /><span class="love-number">0</span></span>')); else el.after($('<span class="icon icon-lingot-micro" /><span class="love-number">0</span>')); el = find_love_el(id, root, ".love-number"); } cache.id = id; cache.el = el; } el.text(love); if (!cache.top_el) cache.top_el = $("#topbar").find("#num_lingots"); if (duo.user.attributes.rupees > 0) { --duo.user.attributes.rupees; cache.top_el.text(" " + duo.user.attributes.rupees); } }; var send_one = function(id, root, type) { if (duo.user.attributes.rupees > 0){ if(type==0){ $.post("/comments/" + id + "/love", function(d) {}); } else { $.post("/comments/" + id + "/love", function(d) {"love" in d && update_comment(id, d.love, root);}); } } }; function set_interval_limited(id, root, n) { for(var i=0; i<n; i++){ send_one(id, root, 0); } send_one(id, root, 1); cache.el = null; return; } var lover = function(id, root) { var love = parseInt(prompt("Bạn muốn tặng bao nhiêu lingot?", "1")); if (love > 0 && (love <= 10 || confirm("Bạn có chắc chắn muốn tặng " + love + " lingots không?"))) set_interval_limited(id, root, love); return false; }; var new_give_lingots = function() { var el = this.parentElement; if (el) { var id = null; var root = false; if (el.tagName == "SPAN") { id = document.location.pathname.match(/^\/comment\/([0-9]+)($|\$)/)[1]; root = true; } else if (el.tagName == "DIV") { var i = 4; while (el) { if (!--i) { if (el.id) id = el.id.match(/^comment-([0-9]+)/)[1]; break; } el = el.parentElement; } } if (id) lover(id, root); } return false; }; var main_reg = null; function ajax_complete(e, r, o) { if (!duo || !duo.user) return; if (o.url == "/diagnostics/js_error") return; if (!main_reg) main_reg = new RegExp("^(https://forum.duolingo.com)?/comments/[0-9]+($|\\?|/reply|/upvote|/downvote|/love)"); var a = main_reg.exec(o.url); if (a) { $("#app").undelegate(".give-love", "click"); $("#app").delegate(".give-love", "click", new_give_lingots); $(".discussion-comments-list-item").undelegate(".give-love", "click"); $(".discussion-comments-list-item").delegate(".give-love", "click", new_give_lingots); } } $(document).ajaxComplete(function(e, r, o) { ajax_complete(e, r, o); }); }