Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Fix Ponilauta report/delete forms
- // @description Now without jQuery!
- // @include http://*ponilauta.fi/*
- // ==/UserScript==
- window.addEventListener('load', function(){
- "use strict"; // Strict mode for good clean code
- // If there are at least three forms on a thread page, the bug has **probably** been fixed.
- // Only checked on thread pages due to inconsistent bug reproducibility in thread listings.
- if (window.location.href.indexOf('/res/') >= 0 && document.getElementsByTagName('form').length >= 3) {
- alert('Report/delete/donate forms have probably been fixed! You may want to delete this user script.')
- }
- // Check if there's a problem to fix (both #reportarea and the donate button exist
- if (!!document.getElementById('reportarea') && !!document.getElementsByClassName('content ads')[0]) {
- // Create a form for the PayPal button
- var form = document.createElement('form');
- form.setAttribute('action','https://www.paypal.com/cgi-bin/webscr');
- form.setAttribute('method','post');
- form.setAttribute('target','_top');
- form.appendChild(document.getElementsByClassName('content ads')[0]); // Append form contents to the form
- document.body.insertBefore(form, document.getElementById('usercount')); // Insert form to the bottom of page
- // Move #reportarea into #delform where it belongs
- document.getElementById('delform').appendChild(document.getElementById('reportarea'));
- // Call the set_delpass function to auto-input password
- if (typeof set_delpass == 'function') {
- set_delpass('delform');
- }
- }
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment