Greasy Fork is available in English.

GitHub: Blame Previous Commit Button

Add a button to `git blame` the `sha^` (parent commit) on each commit on a `git blame` page.

< GitHub: Blame Previous Commit Buttonについてのフィードバック

レート:良 – スクリプトは良好に動作する

§
投稿日: 2015/12/14

eliminate jquery dependency

This is brilliant, thanks!

I am attempting to incorporate this script into a chrome extension I maintain. (I hope that is okay, there is no license information here).

I do not want to have a dependency on jQuery, so I'm looking for a way to replace the 'pjax:end' listener. I tried document.addEventListener('pjax:end', main); but that does not appear to be working. Any help you could provide would be appreciated.

I should note, this event listener does not appear to be necessary (github blame pages cause full page refreshes, and the function is called once on page load). However I do notice while navigating github that not every request causes a full page refresh, so at times, chrome extensions' contentscript.js will not always fire.

Thanks, Aaron

Zren作者
§
投稿日: 2015/12/14
編集日: 2015/12/14

Yeah go ahead.

github blame pages cause full page refreshes

Is that so? Ah well. I built this script based on another script I made that did have to deal with it. Though maybe it's because it's slow to render the page and pjax times out causing the full refresh.

GitHub itself loads jQuery, so you can just grab the already loaded reference to it.

I'm not sure how jQuery binds event listeners with namespaces so I'm not sure how to bind with native APIs.

Toss debugger; into your script and check what's visible. Worst case you'd have to do an injected script instead of a content script to get access to the window object (assuming I understand chrome extensions correctly).

返信を投稿

返信を投稿するにはログインしてください。