-
Notifications
You must be signed in to change notification settings - Fork 2
/
content_script.js
45 lines (40 loc) · 1.36 KB
/
content_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$(document).on("click", ".issue-card a", function(e) {
var url = e.target.href;
if ( url.indexOf('/issues/') != -1 || url.indexOf('/pull/') != -1 ) {
dispLoading("少々お待ちを〜");
$.ajax({
type: "GET",
url: url,
}).done(function(msg) {
var html = msg.replace(/<script.*?<\/script>/g, "");
$.colorbox({
width:"1140",
height:"85%",
html:html,
onComplete: function() {
removeLoading()
var issue_title = $("#cboxLoadedContent .js-issue-title").text();
$("#cboxLoadedContent .Header").remove();
$("#cboxLoadedContent .pagehead").replaceWith('<div> </div>');
$("#cboxLoadedContent a[href$='/issues/new']").remove();
$("#cboxLoadedContent .js-issue-title").replaceWith('<a href="'+url+'">'+issue_title+'</a>');
$("#cboxLoadedContent .issues-listing").removeAttr("data-pjax");
$("#cboxLoadedContent a[data-pjax]").removeAttr("data-pjax");
}
});
});
return false;
}
});
$(document).on("click", "#cboxLoadedContent a", function(e) {
var url = e.target.href;
window.open(url);
return false;
});
function dispLoading(msg){
var dispMsg = "<div class='loadingMsg'>" + msg + "</div>";
$("body").append("<div id='loading'><h3>" + dispMsg + "</h3></div>");
}
function removeLoading(){
$("#loading").remove();
}