Hot answers tagged

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 ...


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....


4

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.3 // @description Unprotect questions in a batch // @author rene // @match https://*.stackexchange.com/tools/protected-questions // @grant ...


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

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 ...


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

I have written a chat bot. Do I need to announce its existence on Stack Apps? No, it is not mandatory to announce your chat bot with a post on Stack Apps. It is appreciated if you do, specially if your bot is present in public chat rooms and users stumble upon it. See your post as a service to (potential) users in case of questions / issues / bugs or ...


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( ( ...


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

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

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

You can't. The summary is only visible on Homepage tabs or the /tagged/[tag] endpoint for a few tags. The following endpoints show the summary in the post list: https://stackapps.com/?tab=apps https://stackapps.com/?tab=scripts https://stackapps.com/questions/tagged/app https://stackapps.com/questions/tagged/script https://stackapps.com/questions/tagged/...


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

You are not supposed to open Stack Exchange sites in an iframe and doing so might violate the terms of service. Also, attempting to do this is part of a technique used by cyber-criminals ("clickjacking"). You don't want to look like one of them. ;) If you try, your browser will give you errors like: Load denied by X-Frame-Options: http://meta....


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'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