-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
userscript version of the Chrome extension #21
Conversation
this is just a copy of /project/useful-forks.js
fixed : useful-forks#9 fixed : useful-forks#4 only call if GITHUB_ACCESS_TOKEN has been set up or show an error
That is looking like some really great work: I'll review the PR in the coming days. Thanks a lot for your contribution ! Are you aware of whether it would be possible not to duplicate the JavaScript code used for the Chrome plugin ? I know Maybe @fregante 's expertise could be helpful here. |
(Sorry, I thought changing the title would link the other issue, but I ended up having to edit your OP.) |
Is that what fixes #9 ? Also, does Violentmonkey require the script to be within that |
yes , github use for some pages Pjax to deliver a faster browsing experience without reloading the full page.
i don't think so , just a habit |
Would you mind creating 2 extra PRs for the fixes of #4 and #9 ? I'd do it myself, but I'll respect your "ownership" of the solutions, in case you wanted to be labeled as a contributor. I'd merge both those PRs into the Chrome script. For this current PR, I don't have a lot of time to test it just yet. I'll eventually try to simply add your |
Alright, #25 was perfect, thanks for that! I tried to incorporate your fix for #9 but couldn't get it to work properly. Have you tested if those cases work properly:
|
Alright, now that I've incorporated both of your side-fixes into the main branch, it could be interesting to look into what this actually has to offer. Have you tried incorporating your code directly into the Chrome plugin's script and seeing how well it works for people with and without |
Violentmonkey is an userscript manager // get token from local storage provided by the userscript manager.
let GITHUB_ACCESS_TOKEN = GM_getValue('GITHUB_ACCESS_TOKEN')
// add menu
GM_registerMenuCommand("Set Github Access Token", setPersonalToken)
GM_registerMenuCommand("Generate New Access Token", newPersonalToken);
// store token in local storage provided by the userscript manager.
function setPersonalToken(){
var mess = "Personal Access Token";
var caseShow = GITHUB_ACCESS_TOKEN;
var getpersonalToken = prompt(mess, caseShow);
GITHUB_ACCESS_TOKEN = (getpersonalToken===null? GITHUB_ACCESS_TOKEN : getpersonalToken)
GM_setValue("GITHUB_ACCESS_TOKEN", GITHUB_ACCESS_TOKEN)
}
// open url to generate a new personal token in new tab
function newPersonalToken(){
let tabControl = GM_openInTab("https://github.com/settings/tokens/new?scopes=repo&description=UsefulFork")
tabControl.onclose = () => setPersonalToken();
} this should work in most other userscript managers (like Greasemonkey, Tampermonkey..) |
My main concern is the duplication of code. Is there a way to integrate it within the chrome script in a non-intrusive way? I'm already bothered by a large portion of the code being duplicated, I wouldn't want to have to maintain a third duplicate. |
hey any news about this ? |
Any update? This would be a great addition! |
As mentioned, I'm kind of bothered by the duplication of code. See #21 (comment). |
what about creating a separate file that contain all shared functions and variables |
Maybe that could work. As a Java dev, what comes to mind is abstracting with an interface that has a few default methods for the shared ones, and then some different implementations for the Chrome and Monkey plugins. |
The plugin has been heavily modified (see 63b9a3c). I'm closing the PR because it would basically need a rewrite anyways. |
closes #20