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

Your value for channelUrl is nominally correct. If I set up my XAMPP server, via httpd.conf to use port 8000, then this HTML page works perfectly fine for me: <!DOCTYPE html> <html><head> <title>StackApps SDK auth test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head><...


5

Yes, it can be annoying that the API docs, the javascript SDK, and the settings pages use the terms: "Explicit" "Implicit" "Server side" "Client side" a little interchangeably. (The first 2 are roughly synonymous with the last two.) From the javascript SDK docs: Your application must have the client side OAuth flow enabled, and must not have the ...


4

Since the .getTime() value is already in UTC, you can just divide by 1000, and round. That is: var apiDate = Math.round (new Date().getTime() / 1000); works just fine. apiDate is in "unix epoch time" and the API takes these values even if the API parameter is called a "Date". But, if you want to truncate to the date only, just use: var dateTime = new ...


4

What Gets Sent Madara Uchiha posted a comment asking about what information was being tracked. This answer should help clarify what's going on. The Client When the script sends a message to the server, it is one of four types: active - sent whenever the tab loses or gains focus. Other users will see your image fade when focus is lost. typing - sent ...


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

bug After I have installed this userscript, I got the menu toolbar empty: Also I have got this in the console: jQuery.Deferred exception: t.find(...).unadornedButtonClick is not a function c@https://cdn.sstatic.net/Js/full.en.js?v=9fbfb8dc3749:9:7713 h@https://cdn.sstatic.net/Js/full.en.js?v=9fbfb8dc3749:9:9001 et@https://cdn.sstatic.net/Js/full.en.js?v=...


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

From the documentation: Apps must have a registered Stack Apps post to write. The next sentence (about links pointing back) is no longer true, but the one after that is right and important too: You can add or change your app's registered post from the Stack Apps App Management page. Since this question is tagged app, you can use this one as the ...


3

Instead of polling for it, you can use a MutationObserver which exists for this exact thing: var observer = new MutationObserver(function(mutations, observer) { for (var i = 0; i < mutations.length; i++) { if ($(mutations[i].target).is('.share-tip')) { //do your thing } } }); observer.observe(document.body, { ...


3

Of course as soon as I finally break down and ask a question I see my mistake: Applications that have the client side flow enabled can use https://stackexchange.com/oauth/login_success as their redirect_uri by default. I had "Desktop OAuth Redirect Uri" disabled which the javascript SDK uses. (Note the url posted in the question) Leaving this up here in ...


3

I faced the same issue when I was using the stack exchange API to post a message to stack overflow website. I figured I had to post my application on a domain name. I hosted my application on free domain provided by 000webhost.com. You may wish to take a similar approach. After deploying the application on the domain, change the oauth domain and the ...


2

How come the code isn't formatted to be in different colors? (etc, how they show on SO)


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

There is an example of how to invoke the constructor here: // app/src/resolvers.js const stackexchange = require('stackexchange-node'); const config = require('../config/config'); const options = {version: 2.2}; const context = new stackexchange(options); const API_KEY = config['API_KEY']; const resolvers = { Query: { questions: async (root, {...


2

Luckily for us, Stack Exchange's unminified Javascript is available on dev.stackoverflow.com. When you have a filename of the script you want to unminify (eg, from the network tab, you see https://cdn.sstatic.net/Js/full.en.js?v=68bef5b3498f, which has a filename of full.en.js), all you need to do is append it after https://dev.stackoverflow.com/content//Js/,...


2

feature-request Could we enable this userscript in the edit page? When I try to edit anything (either question or answer), I don't see the option to turn on/off. Here is an example: I am not sure if this is a bug or feature-request but I will tag as feature request anyway.


1

bug status-completed Fixed in version 1.2. It doesn't work on Firefox with Windows 10, there is no option in the text box: I tried version 1.0 also. On closer inspection, I saw an error in the console: Script error in [Greasemonkey script https://github.com/SpectricSO/stack-scripts/Tab4SE; version 1.1]: ReferenceError: $ is not defined Tab4SE:76:19


1

An access_token is not enough; you need to specify a value for key as well. You can find it in the entry for your app here, this is how it looks like for one of mine: I'm not sure how it works in JavaScript, but in cases like yours the API will send error details in the body; your library may ignore it by default if the HTTP code indicates an error, but it'...


1

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


1

I'll report my findings based on Brock's answer and my tests. 1) I was using Scriptish. Well, don't. Once I moved to Greasemonkey many things that were working on Chrome's Tampermonkey (where I started to develop) started to work on Firefox. 2) Chrome recognizes StackExchange at root level with @grant none. Firefox does not. 3) To make it cross browser ...


1

The question is still not clear, please rewrite it like: I do X. I expect Y. But I get Z. Update: From the comments: Apparently the OP's problem really was that accessing StackExchange.options.routeName in the script, outside the injected code, caused a ReferenceError, when using Scriptish, not Tampermonkey and Greasemonkey as stated in the question. ...


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