Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name ESR AJAX Plus
- // @namespace http://www.esreality.com/
- // @version 2.0
- // @description "Plus" posts without reloading the page!
- // @include http://www.esreality.com/*
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
- // ==/UserScript==
- $('a[title^="Click [+]"]').each(function(i, item) {
- var $self = $(this);
- $self.click(function() {
- var href = $self.attr('href');
- var post_id = parseInt(href.match(/post_id=(\d+)/)[1]);
- $.ajax({url: href, dataType: 'html'}).success(function(html) {
- var selector = 'a[class="judgementvalue"][href$="post_id=' + post_id + '"]'
- , $jv = $(selector);
- if ($jv.length) {
- $jv.html($(selector, html).html());
- } else {
- $self.before($(selector, html), " ");
- }
- }).error(function() {
- alert('Something went wrong, sorry :/');
- })
- return false;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement