Last active
February 10, 2017 01:36
-
-
Save angelarias/fbb76ef5fdec6ea609dbeb1647c81b56 to your computer and use it in GitHub Desktop.
recomendar post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name RecoPost | |
| // @include *://www.taringa.net/mi/notificaciones | |
| // @version 2.6 | |
| // @description Recomienda el ultimo post creado. | |
| // @match *://www.taringa.net/mi | |
| // @icon http://o1.t26.net/images/favicon.ico | |
| // @grant none | |
| // ==/UserScript== | |
| /* jshint -W097 */ | |
| (function ($){ | |
| var contenido = $('<style>.input-caza {display: inline-block; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: 100px; height: 25px; cursor: pointer; top: 0; right: 0; bottom: 0; left: 0; padding: 0 20px; overflow: hidden; border: 1px solid #52A8E8; -webkit-border-radius: 2px; border-radius: 2px; font: normal 15px/normal Arial, Helvetica, sans-serif; color: #003d70; text-decoration: normal; -o-text-overflow: ellipsis; text-overflow: ellipsis; background: #bfe4ff; -webkit-transition: all 502ms cubic-bezier(0.68, -0.75, 0.265, 1.75); -moz-transition: all 502ms cubic-bezier(0.68, -0.75, 0.265, 1.75); -o-transition: all 502ms cubic-bezier(0.68, -0.75, 0.265, 1.75); transition: all 502ms cubic-bezier(0.68, -0.75, 0.265, 1.75); } .input-caza:hover {width: 150px; -webkit-transition: all 500ms cubic-bezier(0.68, -0.75, 0.265, 1.75); -moz-transition: all 500ms cubic-bezier(0.68, -0.75, 0.265, 1.75); -o-transition: all 500ms cubic-bezier(0.68, -0.75, 0.265, 1.75); transition: all 500ms cubic-bezier(0.68, -0.75, 0.265, 1.75); } .input-caza:focus {cursor: default; padding: -13px 20px 0; -webkit-border-radius: 5px; border-radius: 5px; font: italic normal normal 15px/normal Arial, Helvetica, sans-serif; color: #005DAB; background: #e5f4ff; -webkit-transition: all 601ms cubic-bezier(0.68, -0.75, 0.265, 1.75); -moz-transition: all 601ms cubic-bezier(0.68, -0.75, 0.265, 1.75); -o-transition: all 601ms cubic-bezier(0.68, -0.75, 0.265, 1.75); transition: all 601ms cubic-bezier(0.68, -0.75, 0.265, 1.75); }</style><center><div class="box" Style=" background: rgba(192,192,192); border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px;-webkit-border-radius: 5px 5px 5px 5px;border: 0px solid #000000;"><input class="input-caza" type="text" name="user" id="usuario" autocomplete="on" placeholder="Nick del usuario" title="Colocar el nick del Usuario a recomendar sin @ (arroba) y dar click en recomendar."><button id="recom" class="btn a"><font color="#fff">Recomendar</font></button><img src="https://k61.kn3.net/8/2/D/5/2/7/1FE.gif" id="cargando" style="display:none" /><img src="https://k61.kn3.net/FEF3DDEDC.gif" id="error" style="display:none" /></div></center></div>'); | |
| $('#sidebar').prepend(contenido); | |
| var $recomendar = $('#recom'); | |
| var $usuario = $('#usuario'); | |
| $recomendar.on('click', function reco () { | |
| $recomendar.addClass("btn.v"); | |
| var user = $usuario.val().trim(); | |
| var api = 'https://query.yahooapis.com/v1/public/yql?q=select%20link%20from%20rss%20where%20url%3D%27http%3A%2F%2Fwww.taringa.net%2Frss%2F'+ user +'%2Fposts%27&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback='; | |
| $.getJSON( api, function(json) { | |
| var enlace = json.query.results.item[0].link; | |
| var cont = '@'+ user +''+'\n'+'['+'['+'['+'['+ user +']'+']'+']'+']'+'\n'; | |
| $recomendar.hide(); | |
| $usuario.hide(); | |
| $('#cargando').show(); | |
| $.ajax({ | |
| type : 'POST', | |
| dataType: 'json', | |
| url : '/ajax/shout/attach', | |
| data : { | |
| url : enlace | |
| }, | |
| success: function(data){ | |
| $.ajax({ | |
| type : 'POST', | |
| dataType : 'json', | |
| url : '/ajax/shout/add', | |
| data : { | |
| key : global_data.user_key, | |
| body : cont, | |
| privacy : 1, | |
| attachment_type : 3, | |
| attachment : data.data.id | |
| } | |
| }); | |
| $('#cargando').hide(); | |
| }, | |
| error: function(){ | |
| $recomendar.hide(); | |
| $usuario.hide(); | |
| $('#error').show(); | |
| }, | |
| complete: function(){ | |
| $recomendar.show(); | |
| $usuario.show(); | |
| $recomendar.addClass("btn.a"); | |
| $usuario.val(''); | |
| } | |
| }); | |
| }); | |
| }); | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment