Skip to content

Commit 832706c

Browse files
committed
Merge pull request #12 from tophf/master
Chrome browser compatibility with Array.forEach
2 parents 9b0e94c + 674f019 commit 832706c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Github_Comment_Enhancer/Github_Comment_Enhancer.user.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,13 @@
423423
document.getElementById("wiki_format").addEventListener("change", function() {
424424
unbindGollumFunctions();
425425

426-
Array.forEach(document.querySelectorAll(".comment-form-textarea .function-button"), function(button) {
426+
Array.prototype.forEach.call(document.querySelectorAll(".comment-form-textarea .function-button"), function(button) {
427427
button.removeEventListener("click", functionButtonClick);
428428
});
429429
});
430430
}
431431

432-
Array.forEach(document.querySelectorAll(".comment-form-textarea,.js-comment-field"), function(commentForm) {
432+
Array.prototype.forEach.call(document.querySelectorAll(".comment-form-textarea,.js-comment-field"), function(commentForm) {
433433
var gollumEditor;
434434
if (commentForm.classList.contains("GithubCommentEnhancer")) {
435435
gollumEditor = commentForm.previousSibling;
@@ -442,7 +442,7 @@
442442
temp.innerHTML = editorHTML;
443443
temp.firstElementChild.appendChild(document.getElementById("function-help")); // restore the help button;
444444
gollumEditor.replaceChild(temp.querySelector("#gollum-editor-function-buttons"), document.getElementById("gollum-editor-function-buttons"));
445-
Array.forEach(temp.children, function(elm) {
445+
Array.prototype.forEach.call(temp.children, function(elm) {
446446
elm.style.position = "absolute";
447447
elm.style.right = "30px";
448448
elm.style.top = "0";
@@ -474,12 +474,12 @@
474474
}
475475

476476
if (isGist()) {
477-
Array.forEach(gollumEditor.parentNode.querySelectorAll(".select-menu-button"), function(button) {
477+
Array.prototype.forEach.call(gollumEditor.parentNode.querySelectorAll(".select-menu-button"), function(button) {
478478
button.style.paddingRight = "25px";
479479
});
480480
}
481481

482-
Array.forEach(gollumEditor.parentNode.querySelectorAll(".function-button"), function(button) {
482+
Array.prototype.forEach.call(gollumEditor.parentNode.querySelectorAll(".function-button"), function(button) {
483483
if (isGist() && button.classList.contains("minibutton")) {
484484
button.style.padding = "0px";
485485
button.style.textAlign = "center";
@@ -671,7 +671,7 @@
671671
};
672672

673673
function addReplyButtons() {
674-
Array.forEach(document.querySelectorAll(".comment"), function(comment) {
674+
Array.prototype.forEach.call(document.querySelectorAll(".comment"), function(comment) {
675675
var header = comment.querySelector(".timeline-comment-header"),
676676
actions = comment.querySelector(".timeline-comment-actions"),
677677
newComment = document.querySelector(".timeline-new-comment .comment-form-textarea");
@@ -735,7 +735,7 @@
735735

736736
// for inline comments;
737737
var files = document.querySelectorAll('.file-code');
738-
Array.forEach(files, function(file) {
738+
Array.prototype.forEach.call(files, function(file) {
739739
file = file.firstElementChild;
740740
new MutationObserver(function(mutations) {
741741
mutations.forEach(function(mutation) {

0 commit comments

Comments
 (0)