-
Notifications
You must be signed in to change notification settings - Fork 1
/
github_changes_list.min.js
1 lines (1 loc) · 3.13 KB
/
github_changes_list.min.js
1
javascript:(()=>{if(n())return function(){const e=n();e.parentNode.removeChild(e);let t=document.querySelector(".container.new-discussion-timeline.experiment-repo-nav");t&&(t.style="");(t=document.getElementById("files_bucket").parentNode)&&(t.style="")}(),!1;let e,t;function n(){return document.getElementById("fileListHtml")}function o(e){const t=e.target.dataset.idx;e.target.checked?(document.getElementById(`diff-${t}`).classList.remove("Details--on"),document.getElementById(`diff-${t}`).classList.add("open")):(document.getElementById(`diff-${t}`).classList.add("Details--on"),document.getElementById(`diff-${t}`).classList.remove("open"))}function d(e){const t=document.getElementById("nowAnchor");e.target.dataset.idx;t&&(t.id="",t.style.color="#ffffff"),e.target.id="nowAnchor",e.target.style.color="red"}function i(n){const o=document.getElementById("fileListHtml");o.style.top=n.pageY-t+"px",o.style.left=n.pageX-e+"px",o.addEventListener("mouseup",c,!1),document.body.addEventListener("mouseleave",c,!1)}function c(e){const t=document.getElementById("fileListHtml");document.body.removeEventListener("mousemove",i,!1),t.removeEventListener("mouseup",c,!1)}!function(){let e="",t=0;document.querySelectorAll(".file-info > a").forEach(n=>{let o=!0;document.getElementById(`diff-${t}`).classList.contains("Details--on")&&(o=!1);const d=n.innerText;e+='<input type="checkbox"'+(o?" checked ":" ")+`class="fileListCheckBox" data-idx="${t}"> <a data-idx="${t}" class="fileAnchor" href="${n.href}" style="color: #ffffff; text-decoration: none;"><div style="display: inline-block;padding: 0.7rem 0;">${d}</div></a><br>`,t++});const n=document.createElement("div");n.style="white-space: nowrap; line-height: 0;right: 0; padding: 25px;cursor: move; max-height: 80vh;overflow: auto;position: fixed; top: 100px; background-color: #252525;z-index:1000;",n.innerHTML=e,n.id="fileListHtml",document.querySelector(".footer").appendChild(n),n.style.width=`${n.clientWidth}px`,document.querySelectorAll(".fileListCheckBox").forEach(e=>{e.addEventListener("click",o)}),document.querySelectorAll(".fileAnchor").forEach(e=>{e.addEventListener("click",d),e.addEventListener("mouseover",e=>{e.target.style["background-color"]="#555555"}),e.addEventListener("mouseout",e=>{e.target.style["background-color"]=""})})}(),function(){let e=document.querySelector(".container.new-discussion-timeline.experiment-repo-nav");e&&(e.style="margin-left: 1%");(e=document.getElementById("files_bucket").parentNode)&&(e.style="margin-left: 1%")}(),document.getElementById("fileListHtml").addEventListener("mousedown",function(n){if("fileListHtml"!==n.target.id)return!1;e=n.pageX-this.offsetLeft,t=n.pageY-this.offsetTop,document.body.addEventListener("mousemove",i,!1)},!1),window.addEventListener("hashchange",function(){document.querySelectorAll('input[type="checkbox"].fileListCheckBox').forEach(e=>{e.checked?(document.getElementById(`diff-${e.dataset.idx}`).classList.remove("Details--on"),document.getElementById(`diff-${e.dataset.idx}`).classList.add("open")):(document.getElementById(`diff-${e.dataset.idx}`).classList.add("Details--on"),document.getElementById(`diff-${e.dataset.idx}`).classList.remove("open"))})})})();