Hot answers tagged

10

You don't need to support alias domains. They redirect to *.stackexchange.com domains, anyway. This will match all current Stack Exchange sites. It uses @match for smarter domain and path wildcards. @match also works better for Chrome: // @match *://*.askubuntu.com/* // @match *://*.mathoverflow.net/* // @match *://*.serverfault.com/* /...


9

template.user.js // ==UserScript== // @name Stack Exchange Userscript (Template) // @grant none // @match *://*.stackexchange.com/* // @match *://*.stackoverflow.com/* // @match *://*.superuser.com/* // @match *://*.serverfault.com/* // @match *://*.askubuntu.com/* // @match *://*.stackapps.com/* // @match *://*.mathoverflow.net/* // ==/UserScript== var ...


9

Unfortunately the news is bad all around. Sathya has updated the tag wiki for script to include the following paragraph: As of May/June 2012, Chrome no longer allows for direct installations of off-store extensions. To install them, you'll have to download/save the .user.js file, open chrome://chrome/extensions/ (or Click on Wrench -> Tools -> Extensions ...


7

It's allowed with the caveat there's no guarantee it won't be merged, provided that you abide by the good faith criteria. If you attempt to actually run something like the script in your previous post, for example, both accounts will likely be suspended without second thought. Having a separate account for testing doesn't shield you from the consequences of ...


4

Here is a one for css too: // ==UserScript== // @name changeMe // @namespace http://use.your.homepage/ // @version 0.1 // @description addSomethingUseful // @match http*://*.stackoverflow.com/* // @match http*://*.serverfault.com/* // @match http*://*.superuser.com/* // @match http*://*.stackexchange.com/* // @match http*://*.askubuntu....


3

It's debatable whether this question is on topic here, but here is an approach that works in most cases (User has a quality script manager, like Tampermonkey‡, and default settings): Host your script somewhere like GitHub, GreasyFork, etc. Make sure your script has a proper @version directive. Provide direct install links to the hosted script, ...


3

Yes, it is possible to create such a script and here it is: // ==UserScript== // @name Unprotect questions // @namespace https://meta.stackexchange.com/users/158100/rene // @version 0.2 // @description Unprotect questions in a batch // @author rene // @match https://*.stackexchange.com/tools/protected-questions // @grant ...


3

I'm detecting which page we are using the StackExchange object: The property StackExchange.options.routeName can be (among other values): Questions/Show (/questions/POST-ID) Questions/List (/questions) Questions/ListByTag (/questions/tagged/TAG-NAME) So, to run a script only when viewing an individual post: var userscript = function($) { if( ( ...


3

Here's a Greasemonkey / Tampermonkey script that'll run a stop watch until an edit reaches 5 minutes of age. Give it a try and see what you think. It might have bugs, but it's close enough for government work I think. (That's a United States idiom meaning it has the mediocre quality one might expect from the lowest bidder, but it works well enough.) Bear ...


3

The way SOUP handles this is by using a jQuery .ajaxComplete handler to detect when new content is loaded dynamically. SOUP actually has a set of wrapper functions that encapsulate this functionality, but here's a simple stand-alone example from this script, which I originally wrote for SOUP but decided to also make available separately: // re-run the ...


2

Okay, I didn't quite do what you wanted, but hopefully you'll find the solution I came up with acceptable. user-script is now a synonym of script, and I went through and retagged all questions that were about userscripts (but weren't posts intending to make a script available) with just scripts. Admittedly the distinction may not be immediately obvious to ...


2

Alrighty - I found the issue. Tampermonkey assumes that any exception thrown from a user script is an Error object (well...it assumes the exception data will have at least the message and stack properties). When it tries to do string operations on undefined properties, it throws its own exception which makes the whole thing blow up. The Javascript SDK ...


2

You can actually just pass in window.location.hostname directly: This parameter can be the full domain name (ie. "stackoverflow.com"), or a short form identified by api_site_parameter on the site object. (emphasis mine) Since the site does not provide the short form to you directly anywhere, going the full hostname route is probably your best bet. /^((?...


2

No, there isn't. We don't guarantee the javascript interfaces won't change (or that that dialog won't be radically altered). Generally speaking, if you want to mimic a piece of our UI you'll just have to re-implement it if you want it to be stable.


2

There should be a StackExchange method you could hook into, but I don't see it. Also, post text can change for a few reasons. (The user finished an edit, or clicked on a snippet button, or clicked on one of those "This post has been edited" alerts, or triggered a spoiler, etc.) To keep things simple and robust, I recommend just using an interval. EG: var ...


2

The markdown code supposedly lives at the pagedown project on code.google.com. (Reference) You may also find these files to be useful: The commented, human readable version of wmd.js The commented, human readable version of full.js Personally, I find it easier to just use normal <textarea> processing followed by a call to StackExchange....


2

When an HTTP request to show a page is sent to the Stack Exchange web site, a check is explicitly made to ensure that returned page is not loaded into an <iframe>. The response header that comes back for X-Frame-Options is SAMEORIGIN which means that only pages loaded from the same origin can be included in the <iframe>. There are good reasons ...


2

From my personal observation and from the occasional SE dev statement, many items update every 60 seconds (cached at server). Also the page AJAX updates every 60 seconds. (using JS like: setInterval(updateRelativeDates, 60000);) So, per sampling theory, sampling more than once every 30 seconds gives diminishing returns. Personally, I would just reload ...


2

First can I say, you might want to use your own icon. Font Awesome is a very useful and easy to use icon toolkit that lets you add icons with simple CSS classes. You could use http://fontawesome.io/icon/star/ if you want :) However, if you want to use SE's button, in Javascript, if you want to override an event handler, you need to return false; or call ...


1

feature-request status-completed Create a list of users that is currently in the room. Feature request completed.


1

Don't use the default button. That's bad UI anyway. Add your own favorite button for each answer. And, since you will be using your own classes, like: <a class="myStarOff" href="#" data-ansID="1234" title="Click to add as favorite answer (click again to undo)"> favorite</a> <a class="myStarOn" href="#" data-ansID="56789" title="Click to ...


1

The method I ended up using in SOUP 1.10 is the first one listed above — loading the full question page and stripping it down to match the review interface. Here's the core of the actual code: var injectAnswers = function ( html ) { // kluge: disable script tags; $.parseHTML() would be better, but needs jQuery 1.8+ var $html = $( html.replace(...


1

You have two options: 1. Tampermonkey Install Tampermonkey for Chrome; Click the script to install it. 2. Vanilla Chrome Copy the code and save it to a file called anything.user.js; In Chrome, go to chrome://extensions/ (Tools > More Tools > Extensions); Open the folder you saved the script to and drag it onto the Extensions dialog.


1

PHP /** * 101 sites sorted alphabetically * Updated 2013.04.14 */ $se_sites = array ( 'academia' => array( 'Academia', 'http://academia.stackexchange.com', 'Q&A for academics and those enrolled in higher education', ), 'android' => array( 'Android Enthusiasts', 'http://android.stackexchange.com', 'Q&A for ...


1

You're right, this is not very well documented. OAuth Domain is the domain of the URL where users are redirected after authenticating themselves. You specify this URL in redirect_uri parameter of your authentication query. The doc says: redirect_uri - must be under an apps registered domain and also The user is redirected to redirect_uri, with these ...


Only top voted, non community-wiki answers of a minimum length are eligible