diff --git a/GitHubDarkMode Extension/Base.lproj/SafariExtensionViewController.xib b/GitHubDarkMode Extension/Base.lproj/SafariExtensionViewController.xib deleted file mode 100644 index 9436c39..0000000 --- a/GitHubDarkMode Extension/Base.lproj/SafariExtensionViewController.xib +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GitHubDarkMode Extension/Info.plist b/GitHubDarkMode Extension/Info.plist index 4bc8e31..fa99205 100644 --- a/GitHubDarkMode Extension/Info.plist +++ b/GitHubDarkMode Extension/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 0.1.0 + $(MARKETING_VERSION) CFBundleVersion - 1 + $(CURRENT_PROJECT_VERSION) LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSExtension diff --git a/GitHubDarkMode Extension/SafariExtensionHandler.swift b/GitHubDarkMode Extension/SafariExtensionHandler.swift index 6d47c9e..2723756 100644 --- a/GitHubDarkMode Extension/SafariExtensionHandler.swift +++ b/GitHubDarkMode Extension/SafariExtensionHandler.swift @@ -8,27 +8,4 @@ import SafariServices -class SafariExtensionHandler: SFSafariExtensionHandler { - - override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : Any]?) { - // This method will be called when a content script provided by your extension calls safari.extension.dispatchMessage("message"). - page.getPropertiesWithCompletionHandler { properties in - NSLog("The extension received a message (\(messageName)) from a script injected into (\(String(describing: properties?.url))) with userInfo (\(userInfo ?? [:]))") - } - } - - override func toolbarItemClicked(in window: SFSafariWindow) { - // This method will be called when your toolbar item is clicked. - NSLog("The extension's toolbar item was clicked") - } - - override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) { - // This is called when Safari's state changed in some way that would require the extension's toolbar item to be validated again. - validationHandler(true, "") - } - - override func popoverViewController() -> SFSafariExtensionViewController { - return SafariExtensionViewController.shared - } - -} +final class SafariExtensionHandler: SFSafariExtensionHandler {} diff --git a/GitHubDarkMode Extension/SafariExtensionViewController.swift b/GitHubDarkMode Extension/SafariExtensionViewController.swift deleted file mode 100644 index 75d55bd..0000000 --- a/GitHubDarkMode Extension/SafariExtensionViewController.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// SafariExtensionViewController.swift -// GitHubDarkMode Extension -// -// Created by Louis Aeilot on 2020/8/25. -// Copyright © 2020 Louis Studio. All rights reserved. -// - -import SafariServices - -class SafariExtensionViewController: SFSafariExtensionViewController { - - static let shared: SafariExtensionViewController = { - let shared = SafariExtensionViewController() - shared.preferredContentSize = NSSize(width:320, height:240) - return shared - }() - -} diff --git a/GitHubDarkMode Extension/ToolbarItemIcon.pdf b/GitHubDarkMode Extension/ToolbarItemIcon.pdf deleted file mode 100644 index 36d749c..0000000 Binary files a/GitHubDarkMode Extension/ToolbarItemIcon.pdf and /dev/null differ diff --git a/GitHubDarkMode Extension/script.js b/GitHubDarkMode Extension/script.js index 46f854a..bc1daca 100644 --- a/GitHubDarkMode Extension/script.js +++ b/GitHubDarkMode Extension/script.js @@ -1,44 +1,1022 @@ -document.addEventListener("DOMContentLoaded", function(event) { - ((darkModeIsOn) => { - if (darkModeIsOn) { - // The local variables, only available in this anonymous function, so that it won't affect the operation of other scripts. - var body = document.body; - var style = document.createElement('style'); - // Set `style.innerHTML` to the compressed [CSS](../styles/styles.css). - style.innerHTML = '@media (prefers-color-scheme:dark){.bg-gray-light{background-color:#24292e!important}.text-gray{color:#c7d2de!important}a{color:#6aaaf3}.UnderlineNav-octicon{color:#d8e2ec}.UnderlineNav-item{color:#d8e2ec}.Counter{color:#d8e2ec;background-color:rgb(124 127 132 / 50%)}.btn{color:#d8e2ec;background-color:#24292e;box-shadow:0 1px 0 rgb(21 24 27 / 4%),inset 0 1px 0 hsl(0deg 0% 34% / 25%)}.social-count{color:#d8e2ec;background-color:#24292e}body{color:#d8e2ec;background-color:#1f2327}.signup-prompt-bg{background-image:linear-gradient(180deg,rgba(0,0,0,0) 50%,#151515),linear-gradient(70deg,#1a1f23 32%,#202721)}.link-gray{color:#7f8b98!important}.btn.hover,.btn:hover,[open]>.btn{background-color:#2d333a}.topic-tag{background-color:#2b3035}.delete-topic-button,.topic-tag,.topic-tag-action{color:#6aaaf3}.Box-header--blue{background-color:#24292e;border-color:#3d4650}.team-mention,.user-mention{color:#acc3da}.link-gray-dark{color:#24292e!important}.Box-row--focus-gray.navigation-focus{background-color:#2b3035}.Box-row{border-top:1px solid #343435}.link-gray-dark{color:#9ab4ce!important}.Box{background-color:#24292e;border:1px solid #45474a;border-radius:6px}.bg-white{background-color:#1f2327!important}.markdown-body h1,.markdown-body h2{border-bottom:1px solid #646669}.link-gray:hover{color:#6aaaf3!important}.BorderGrid-cell{border:1px solid #676869}.muted-link{color:#8894a2!important}.Progress{background-color:#323940}.text-gray-dark{color:#a5bbd2!important}.markdown-body .highlight pre,.markdown-body pre{background-color:#1f2327}.pl-pds,.pl-s,.pl-s .pl-pse .pl-s1,.pl-sr,.pl-sr .pl-cce,.pl-sr .pl-sra,.pl-sr .pl-sre{color:#2c7bd8}.border-gray-light{border-color:#545658!important}.Box-body{border-bottom:1px solid #424346}.social-count:hover{color:#6aaaf3}.link-gray-dark:hover,.link-hover-blue:hover{color:#6aaaf3!important}.hx_avatar_stack_commit .AvatarStack-body{background-color:transparent}.UnderlineNav{box-shadow:inset 0 -1px 0 #484a4c}.UnderlineNav-item:focus,.UnderlineNav-item:hover{border-bottom-color:#484a4c}.topic-tag-link:hover{background-color:#626b73}.form-control,.form-select{color:#d8e2ec;background-color:#1f2327;border:1px solid #45474a;box-shadow:inset 0 1px 0 rgba(56,57,58,.2)}.border-bottom{border-bottom:1px solid #424346!important}.border-top{border-top:1px solid #424346!important}.dropdown-menu{background-color:#24292e;border:1px solid #424346;box-shadow:0 8px 24px rgb(50 53 56 / 20%)}.dropdown-menu:after{border-bottom-color:#24292e}.dropdown-item{color:#c7d2de}.dropdown-item:focus,.dropdown-item:hover{background-color:#054690}.header-nav-current-user .user-profile-link{color:#c7d2de}.dropdown-divider{border-top:1px solid #424346}.border{border:1px solid #424346!important}.bg-gray{background-color:#1f2327!important}.form-group .form-control{background-color:#1f2327}.border-right{border-right:1px solid #424346!important}.ajax-pagination-form .ajax-pagination-btn{color:#6aaaf3;background:#24292e;border:1px solid #424346!important}.ajax-pagination-form .ajax-pagination-btn:focus,.ajax-pagination-form .ajax-pagination-btn:hover{color:#6aaaf3;background-color:#2d333a}.btn-primary{background-color:#27713c}.subnav-item{color:#d8e2ec;border:1px solid #424346}.Box-header{background-color:#24292e;border:1px solid #3d4650}.table-list-header-toggle .btn-link.selected,.table-list-header-toggle .btn-link.selected:hover{color:#d8e2ec}.table-list-header-toggle .btn-link{color:#bac1c7}.table-list-header-toggle .btn-link:hover{color:#d8e2ec}@media (min-width:544px){.SelectMenu-modal{border:1px solid #424346;box-shadow:0 8px 24px rgb(54 58 62 / 20%)}.project-header{background-color:#1f2327}}.SelectMenu-modal{background-color:#24292e}.SelectMenu-item{background-color:#24292e;border-bottom:1px solid #424346;color:#d8e2ec}.SelectMenu-header{border-bottom:1px solid #424346}@media (hover:hover){.SelectMenu-item:hover,body:not(.intent-mouse) .SelectMenu-item:focus{background-color:#404242}}.subnav-item:focus,.subnav-item:hover{background-color:#404242}.input-contrast:focus{background-color:#24292e}kbd{color:#d8e2e0;background-color:#24292e;border:1px solid #424346;box-shadow:inset 0 -1px 0 #46484a}.MarketplaceBackground-buffer{background:#1f2327}.box-shadow-extra-large{box-shadow:0 12px 48px rgba(56,57,58,.3)!important}.filter-item:hover{background-color:#3f4448}.muted-link:hover{color:#c8e1ff!important}.profile-timeline-card-wrapper{border-top:2px solid #1f2327;border-bottom:2px solid #1f2327}.discussion-item-icon{color:#d8e2ec;background-color:#24292e;border:2px solid #424346}.profile-timeline.discussion-timeline:before{background-color:#424346}.profile-rollup-wrapper+.profile-rollup-wrapper{border-top:1px solid #424346}.profile-timeline.discussion-timeline .profile-timeline-month-heading:after{background-color:#424346}.SelectMenu-item[aria-checked=true]{color:#a2d0ff}.btn-primary.hover,.btn-primary:hover,[open]>.btn-primary{background-color:#165a2a}.CopyBlock:active,.CopyBlock:focus,.CopyBlock:hover{background-color:#24292e}.SelectMenu-filter{border-bottom:1px solid #424346}.ellipsis-expander,.hidden-text-expander a{color:#d8e2ec;background:#24292e}.notifications-list-item:hover{background-color:#24292e!important}.notifications-list-item .notification-list-item-link{color:#dce2ec!important}.notifications-list-item:hover .notification-list-item-link{color:#bcd5ff!important}.btn.selected,.btn:active,.btn[aria-selected=true]{background-color:#424648;box-shadow:inset 0 1px 0 rgb(31 35 39)}.btn-outline.disabled,.btn-outline:disabled,.btn-outline[aria-disabled=true]{color:rgba(3,102,214,.5);background-color:#24292e;border-color:rgb(66 67 70 / .15);box-shadow:0 1px 0 rgba(27,31,35,.04),inset 0 1px 0 hsl(0deg 0% 0% / 25%)}.form-control[disabled],.form-select[disabled]{background-color:#24292e}.text-gray-light{color:#93a4b7!important}.flash{color:#afcae4;background-color:rgba(39,58,78,.8);border-color:rgba(4,66,137,.2);backdrop-filter:blur(16px)}.form-group .form-control:focus{background-color:#24292e}.Box-row--hover-gray:hover{background-color:#2b3035}.TimelineItem--condensed .TimelineItem-badge{background-color:#24292e;border-radius:32px;border:2px solid #424346;color:#d8e2ec}.TimelineItem:before{background-color:#424346}.signed-commit-badge-large,.signed-commit-badge-medium,.signed-commit-badge-small{border:1px solid #6b6c71}.markdown-body img{background-color:transparent}.blob-code-inner{color:#dce6f1}.breadcrumb strong.final-path{color:#d8e2ec}.markdown-body table tr{background-color:#1f2327}.orghead{background-color:#24292e}.Label--gray,.Label--outline{border-color:#768084}.select-menu-filters,.select-menu-header{background-color:#24292e;border-bottom:1px solid #424346}.select-menu-modal{color:#d8e2ec;background-color:#24292e;border:1px solid #424346;box-shadow:0 8px 24px rgb(54 58 62 / 20%)}.select-menu-divider,.select-menu-header .select-menu-title{color:#d8e2ec}.select-menu-item{background-color:#24292e;border-bottom:1px solid #424346}.select-menu-item.selected,details-menu .select-menu-item[aria-checked=true],details-menu .select-menu-item[aria-selected=true]{color:#68b4ff}.select-menu-item.navigation-focus,.select-menu-item.navigation-focus .description-inline,.select-menu-item.navigation-focus.select-menu-action,.select-menu-item.navigation-focus.selected,.select-menu-item.navigation-focus[aria-checked=true],.select-menu-item:focus,.select-menu-item:focus .description-inline,.select-menu-item:focus.select-menu-action,.select-menu-item:focus.selected,.select-menu-item:hover,.select-menu-item:hover .description-inline,.select-menu-item:hover.select-menu-action,.select-menu-item:hover.selected,.select-menu-item[aria-checked=true]:focus,.select-menu-item[aria-checked=true]:hover,.select-menu-item[aria-selected=true] .description-inline,.select-menu-item[aria-selected=true].select-menu-action,.select-menu-item[aria-selected=true]:focus,.select-menu-item[aria-selected=true]:hover{background-color:#054690}.menu{background-color:#24292e;border:1px solid #45474a}.menu-heading{color:#d8e2ec;border-bottom:1px solid #45474a}.menu-item{color:#c6d1dc;border-color:#424346}.table-list{border-bottom:1px solid #424346}.menu-item:focus,.menu-item:hover{background-color:#34393c}.Header{color:hsl(0deg 0% 0% / 70%)}.header-search-current .header-search-wrapper.focus{background-color:hsl(0deg 0% 0% / 18%)}.header-search-current .jump-to-field-active{color:#d8e2ec!important;background-color:#373a3e}.header-search-current .jump-to-suggestions-results-container .navigation-item{border-bottom:1px solid #424346}.header-search-current .jump-to-suggestions-path{color:#d8e2ec}.header-search-current .jump-to-suggestions-results-container .navigation-focus .jump-to-suggestions-path,.header-search-current .jump-to-suggestions-results-container [aria-selected=true] .jump-to-suggestions-path{background:#054690}.rule,hr{border-bottom:1px solid #424346}.file-header{background-color:#24292e;border-bottom:1px solid #424346}.tabnav-tab{color:#d8e2ec}.tabnav-tab.selected,.tabnav-tab[aria-current]:not([aria-current=false]),.tabnav-tab[aria-selected=true]{background-color:#24292e;border-color:#424346}.file{border:1px solid #424346}.cm-s-github-light.CodeMirror{background:#24292e;color:#d8e2ec}.cm-s-github-light .CodeMirror-gutters{background:#1f2327}.cm-s-github-light .CodeMirror-lines{background:#24292e}.cm-s-github-light .cm-string{color:#96bae4}@media (min-width:1012px){.border-lg-bottom,.border-lg-left,.border-lg-right,.border-lg-top{border-color:#424346!important}}.commit-form:before{border-right-color:#424346}.commit-form:after{border-right-color:#1f2327}.btn-outline:hover,[open]>.btn-outline{background-color:#003e84}.timeline-comment{color:#d8e2ec;background-color:#24292e}.new-discussion-timeline .composer .comment-form-head.tabnav{background-color:#24292e}.drag-and-drop{border-color:#424346;background-color:#24292e}@media (min-width:768px){.composer.composer-responsive .timeline-comment:before{border-right-color:#424346}.composer.composer-responsive .timeline-comment:after{border-right-color:#24292e}.composer.composer-responsive .timeline-comment{border:1px solid #424346}.page-responsive .previewable-comment-form .comment-form-head.tabnav{background:#24292e}.border-md{border:1px solid #424346!important}}.gh-header{background-color:#1f2327}.gh-header-meta{border-color:#424346}.discussion-sidebar-item+.discussion-sidebar-item{border-color:#424346}.timeline-comment,.timeline-comment-header{border-color:#424346}.timeline-comment-header{background-color:#24292e}.gh-header .gh-header-sticky.is-stuck+.gh-header-shadow{background-color:rgb(36 41 46 / .8);border-bottom:1px solid rgb(255 255 255 / 15%);backdrop-filter:blur(16px)}.pagination-loader-container{background-color:#1f2327;background-image:none}.discussion-timeline-actions{background-color:#1f2327;border-top:2px solid #424346}.timeline-comment-wrapper{border-color:#424346}.pl-k{color:#ff5565}.pl-e,.pl-en{color:#8d5fe0}.pl-s .pl-s1,.pl-smi{color:#cde4fb}.pl-ent{color:#36ca59}.pl-c1,.pl-s .pl-v{color:#3f91ef}.subnav-link.selected{color:#d8e2ec!important}.subnav-link{color:#b6c0ca}.box-shadow-medium{box-shadow:0 3px 6px rgb(31 35 39 / .15)!important}.tabnav{border-color:#424346}.Box-footer{border-color:#424346}.box-shadow-large{box-shadow:0 8px 24px rgb(31 35 39 / .2)!important}.Popover-message--bottom-left:after,.Popover-message--bottom-right:after,.Popover-message--bottom:after{border-top-color:#24292e}.TimelineItem-break{background-color:#1f2327;border-color:#424346}.page-responsive .previewable-comment-form .comment-form-head.tabnav .toolbar-commenting{background:#1f2327}.bg-blue-light{background-color:#1b3752!important}.setup-info-module{background-color:#24292e;border-color:#424346}.setup-info-module h2{border-color:#424346}.setup-header{border-color:#424346}.setup-header .lead{color:#a9b0b7}.note{color:#a9b0b7}.select-menu-text-filter input{border-color:#424346}.select-menu-text-filter:first-child:last-child{border-color:#424346}.subnav-link:hover{color:#a9b0b7}.Subhead{border-color:#424346}mark{color:#aed6ff}.filter-item{color:#a9b0b7}.markdown-body table td,.markdown-body table th{border-color:#424346}.markdown-body table tr:nth-child(2n){background-color:#24292e}.markdown-body hr{background-color:#424346}.codesearch-results .repo-list-item+.repo-list-item{border-top:1px solid #424346}.pagination a,.pagination em,.pagination span{color:#d8e2e6}.site-subnav-sticky{background-color:rgb(31 35 39 / .8)!important;backdrop-filter:blur(16px)}.fade-img-to-white-bg:before{background:linear-gradient(180deg,#1f2327 0,hsl(210 11% 14% / 0))}.fade-img-to-white-bg:after{background:linear-gradient(0deg,#1f2327 0,hsl(210 11% 14% / 0))}.Box-row--gray{background-color:#24292e}.pinned-item-name{color:#d8e2ec}.pinned-item-checkbox:checked+.pinned-item-name{color:#6aaaf3;background-color:#24292e}.tabnav-pr .tabnav-tab{color:#b8c1cc}.tabnav-pr .tabnav-tab.selected{color:#d8e2ec;border-color:#424346}.TimelineItem-body{color:#d8e2ec}.thread-subscription-status{background-color:#1f2327}.discussion-sidebar-heading{color:#d8e2ec}.discussion-sidebar-item{color:#b2bcc5}.branch-action-body{background-color:#24292e}.branch-action-state-clean .branch-action-body{border-color:#2b6538}.merge-status-list{border-color:#424346}.merge-status-item{background-color:#24292e;border-color:#424346}.text-emphasized{color:#b2bcc5}.status-meta{color:#b2bcc5}.branch-action-body .merge-branch-form,.branch-action-body .merge-message{background-color:#24292e;border-color:#424346}.btn-link{color:#6aaaf3}.previewable-comment-form .comment-form-head.tabnav{background:#24292e}.timeline-comment-label{border-color:#424346}.timeline-comment--caret:before{border-right-color:#424346}.timeline-comment--caret:after{border-right-color:#24292e}.diffbar{background-color:#1f2327}.blob-num-expandable,.blob-num-hunk{background-color:#24292e}.blob-code-hunk{background-color:#24292e}.blob-num-addition{background-color:#2f4032;border-color:#2f4032}.blob-code-addition{background-color:#2f4032}.blob-num{color:rgb(199 227 255 / 30%)}.blob-num-deletion{background-color:#483f40;border-color:#483f40}.blob-code-deletion{background-color:#483f40}.pr-toolbar.is-stuck{background-color:#1f2327}.commit-ref{background-color:#274466}.timeline-comment.current-user .timeline-comment-header{background-color:#24292e;border-bottom-color:#424346}.timeline-comment.current-user{border-color:#424346}.branch-action-body,.branch-action-state-closed-dirty .branch-action-body,.branch-action-state-dirty .branch-action-body,.is-rebasing .branch-action-state-dirty-if-rebasing .branch-action-body{border-color:#424346}.branch-action-item+.branch-action-item,.branch-action-item+.mergeability-details{border-color:#424346}.btn.disabled,.btn:disabled,.btn[aria-disabled=true]{color:#d8e2ec;background-color:#292f35}.discussion-timeline.team-discussion-timeline .blankslate{background:#24292e}.range-editor{background-color:#24292e;border-color:#424346}.file-diff-split .blob-code+.blob-num{border-color:#424346}.table-list-header{background-color:#24292e;border-color:#424346}.table-list{border-color:#424346}.table-list-bordered .table-list-cell:first-child{border-color:#424346}.table-list-bordered .table-list-cell:last-child{border-color:#424346}.table-list-cell{border-color:#424346}.orgs-help-shelf{border-color:#424346}.orgs-help-item-octicon{background-color:#24292e;border-color:#424346}.review-thread-reply{background-color:#24292e;border-color:#424346}.discussion-post .timeline-inline-comments{background:0 0}.task-progress .progress-bar{background-color:#424346}.markdown-body blockquote{border-color:#424346}.review-thread-reply{background-color:#24292e;border-color:#424346}.TimelineItem-badge{color:#d8e2ec;background-color:#24292e;border-color:#424346}.review-comment .reaction-summary-item:not(.add-reaction-btn){border-color:#424346}.copyable-terminal{background-color:#1f2327}.review-thread-reply .inline-comment-form{background-color:#24292e}.form-group.errored .error{background-color:#463434;border-color:#77454b}.home-enterprise-wrapper:before{background-color:#2b3137}.timeline-comment--caret.current-user:before{border-right-color:#424346}.timeline-comment--caret.current-user:after{border-right-color:#24292e}.timeline-comment.current-user .timeline-comment-label{border-color:#424346}.project-column{background-color:#24292e}.project-card:hover{border-color:#727479!important}.comment-reactions.has-reactions{border-color:#424346}.reaction-summary-item{border-color:#424346}.project-pane{background-color:rgba(36,41,46,.8)!important;backdrop-filter:blur(16px);box-shadow:none}.project-issue-body-blur{background:linear-gradient(0deg,#23282d,hsl(210deg 12% 16% / 0))}.comment-reactions.has-reactions{border-color:#424346}.comment-reactions .user-has-reacted{background-color:#24292e}.reaction-summary-item{border-color:#424346}.full-commit{background:#24292e;border-color:#424346}.full-commit p.commit-title{color:#acc3da}.full-commit .commit-meta{background:#1f2327;border-color:#424346}.commit-sha{background-color:#24292e;border-color:#424346}.thread-subscription-status{border-color:#424346}.upload-enabled textarea{border-color:#424346}@media (min-width:768px){.border-md-top{border-color:#424346!important}}.discussion-post .reply-comment:first-child{border-color:#424346}.discussion-post .reply-comments-holder:before{background-color:#424346}.review-comment{color:#d8e2ec}.notifications-list-item.notification-unread{background-color:#24292e}.notifications-list-item.notification-unread .notification-list-item-link{color:#d8e2ec!important}.timeline-comment-header{color:#d8e2ec}.Popover-message:after{border-bottom-color:#24292e}.Popover-message:before{border-bottom-color:#424346}.file-diff-split .empty-cell{background-color:#24292e}.diff-table tr:not(:last-child) .line-comments{border-color:#424346}.inline-comment-form{border-color:#424346}.CheckRun-header{border-top-color:#424346}.commit-ref{color:#6aaaf3}.commit-ref .user{color:#6aaaf3}.user-status-circle-badge{background-color:#24292e;border-color:#424346}.session-authentication{background-color:#1f2327}.session-authentication .auth-form-header{color:#d8e2ec}.auth-form-body{background-color:#24292e;border-color:#424346}.session-authentication .auth-form-body{border-color:#424346}}'; - // Append to - body.appendChild(style); +// The entrance of the extension, will run when `document` is ready - // If at Explore page - if (window.location.href.match('https://github.com/explore*') || window.location.href.match('https://github.com/topics*')) { - // Select the white background and replace it - document.querySelector(".border-bottom.border-gray-light").setAttribute("style", ""); - // Set `explorePageTopicsGradientMaskSelector` to the selector of the recommandation list - var explorePageTopicsGradientMaskSelector = '[style="background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));"]'; - // Edit its mask then - for ( - let ele = document.querySelector(explorePageTopicsGradientMaskSelector); - document.querySelector(explorePageTopicsGradientMaskSelector); - ele = document.querySelector(explorePageTopicsGradientMaskSelector) - ) { - ele.style.background = "linear-gradient(to top, rgb(31 35 39), rgb(31 35 39 / 0))" - } - // If on topic page - if (window.location.href.match('https://github.com/topics*')) { - document.querySelector('[style="background-color: #fcfdfd;"]').style.backgroundColor = '#1F2327'; - } +// The anonymous function: `( (params) => {} )(params)` +((darkModeIsOn) => { + if (darkModeIsOn) { + // The local variables, only available in this anonymous function, so that it won't affect the operation of other scripts. + var body = document.body; + var style = document.createElement('style'); + // Set `style.innerHTML` to the compressed [CSS](../styles/styles.css). + style.innerHTML = `@media (prefers-color-scheme: dark) { + .bg-gray-light { + background-color: #24292e!important; + } + .text-gray { + color: #c7d2de!important; + } + a { + color: #6aaaf3; + } + .UnderlineNav-octicon { + color: #d8e2ec; + } + .UnderlineNav-item { + color: #d8e2ec; + } + .Counter { + color: #d8e2ec; + background-color: rgb(124 127 132 / 50%); + } + .btn { + color: #d8e2ec; + background-color: #24292e; + box-shadow: 0 1px 0 rgb(21 24 27 / 4%), inset 0 1px 0 hsl(0deg 0% 34% / 25%); + } + .social-count { + color: #d8e2ec; + background-color: #24292e; + } + body { + color: #d8e2ec; + background-color: #1f2327; + } + .signup-prompt-bg { + background-image: linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, #151515), linear-gradient(70deg, #1a1f23 32%, #202721); + } + .link-gray { + color: #7f8b98!important; + } + .btn.hover, .btn:hover, [open]>.btn { + background-color: #2d333a; + } + .topic-tag { + background-color: #2b3035; + } + .delete-topic-button, .topic-tag, .topic-tag-action { + color: #6aaaf3; + } + .Box-header--blue { + background-color: #24292e; + border-color: #3d4650; + } + .team-mention, .user-mention { + color: #acc3da; + } + .link-gray-dark { + color: #24292e!important; + } + .Box-row--focus-gray.navigation-focus { + background-color: #2b3035; + } + .Box-row { + border-top: 1px solid #343435; + } + .link-gray-dark { + color: #9ab4ce!important; + } + .Box { + background-color: #24292e; + border: 1px solid #45474a; + border-radius: 6px; + } + .bg-white { + background-color: #1f2327!important; + } + .markdown-body h1, .markdown-body h2 { + border-bottom: 1px solid #646669; + } + .link-gray:hover { + color: #6aaaf3!important; + } + .BorderGrid-cell { + border: 1px solid #676869; + } + .muted-link { + color: #8894a2!important; + } + .Progress { + background-color: #323940; + } + .text-gray-dark { + color: #a5bbd2!important; + } + .markdown-body .highlight pre, .markdown-body pre { + background-color: #1f2327; + } + .pl-pds, .pl-s, .pl-s .pl-pse .pl-s1, .pl-sr, .pl-sr .pl-cce, .pl-sr .pl-sra, .pl-sr .pl-sre { + color: #2c7bd8; + } + .border-gray-light { + border-color: #545658!important; + } + .Box-body { + border-bottom: 1px solid #424346; + } + .social-count:hover { + color: #6aaaf3; + } + .link-gray-dark:hover, .link-hover-blue:hover { + color: #6aaaf3!important; + } + .hx_avatar_stack_commit .AvatarStack-body { + background-color: transparent; + } + .UnderlineNav { + box-shadow: inset 0 -1px 0 #484a4c; + } + .UnderlineNav-item:focus, .UnderlineNav-item:hover { + border-bottom-color: #484a4c; + } + .topic-tag-link:hover { + background-color: #626b73; + } + .form-control, .form-select { + color: #d8e2ec; + background-color: #1f2327; + border: 1px solid #45474a; + box-shadow: inset 0 1px 0 rgba(56, 57, 58, 0.2); + } + .border-bottom { + border-bottom: 1px solid #424346!important; + } + .border-top { + border-top: 1px solid #424346!important; + } + .dropdown-menu { + background-color: #24292e; + border: 1px solid #424346; + box-shadow: 0 8px 24px rgb(50 53 56 / 20%); + } + .dropdown-menu:after { + border-bottom-color: #24292e; + } + .dropdown-item { + color: #c7d2de; + } + .dropdown-item:focus, .dropdown-item:hover { + background-color: #054690; + } + .header-nav-current-user .user-profile-link { + color: #c7d2de; + } + .dropdown-divider { + border-top: 1px solid #424346; + } + .border { + border: 1px solid #424346!important; + } + .bg-gray { + background-color: #1f2327!important; + } + .form-group .form-control { + background-color: #1f2327; + } + .border-right { + border-right: 1px solid #424346!important; + } + .ajax-pagination-form .ajax-pagination-btn { + color: #6aaaf3; + background: #24292e; + border: 1px solid #424346!important; + } + .ajax-pagination-form .ajax-pagination-btn:focus, .ajax-pagination-form .ajax-pagination-btn:hover { + color: #6aaaf3; + background-color: #2d333a; + } + .btn-primary { + background-color: #27713c; + } + .subnav-item { + color: #d8e2ec; + border: 1px solid #424346; + } + .Box-header { + background-color: #24292e; + border: 1px solid #3d4650; + } + .table-list-header-toggle .btn-link.selected, .table-list-header-toggle .btn-link.selected:hover { + color: #d8e2ec; + } + .table-list-header-toggle .btn-link { + color: #bac1c7; + } + .table-list-header-toggle .btn-link:hover { + color: #d8e2ec; + } + @media (min-width: 544px) { + .SelectMenu-modal { + border: 1px solid #424346; + box-shadow: 0 8px 24px rgb(54 58 62 / 20%); + } + .project-header { + background-color: #1f2327; + } + } + .SelectMenu-modal { + background-color: #24292e; + } + .SelectMenu-item { + background-color: #24292e; + border-bottom: 1px solid #424346; + color: #d8e2ec; + } + .SelectMenu-header { + border-bottom: 1px solid #424346; + } + @media (hover: hover) { + .SelectMenu-item:hover, body:not(.intent-mouse) .SelectMenu-item:focus { + background-color: #404242; + } + } + .subnav-item:focus, .subnav-item:hover { + background-color: #404242; + } + .input-contrast:focus { + background-color: #24292e; + } + kbd { + color: #d8e2e0; + background-color: #24292e; + border: 1px solid #424346; + box-shadow: inset 0 -1px 0 #46484a; + } + .MarketplaceBackground-buffer { + background: #1f2327; + } + .box-shadow-extra-large { + box-shadow: 0 12px 48px rgba(56, 57, 58, .3)!important; + } + .filter-item:hover { + background-color: #3f4448; + } + .muted-link:hover { + color: #c8e1ff!important; + } + .profile-timeline-card-wrapper { + border-top: 2px solid #1f2327; + border-bottom: 2px solid #1f2327; + } + .discussion-item-icon { + color: #d8e2ec; + background-color: #24292e; + border: 2px solid #424346; + } + .profile-timeline.discussion-timeline:before { + background-color: #424346; + } + .profile-rollup-wrapper+.profile-rollup-wrapper { + border-top: 1px solid #424346; + } + .profile-timeline.discussion-timeline .profile-timeline-month-heading:after { + background-color: #424346; + } + .SelectMenu-item[aria-checked=true] { + color: #a2d0ff; + } + .btn-primary.hover, .btn-primary:hover, [open]>.btn-primary { + background-color: #165a2a; + } + .CopyBlock:active, .CopyBlock:focus, .CopyBlock:hover { + background-color: #24292e; + } + .SelectMenu-filter { + border-bottom: 1px solid #424346; + } + .ellipsis-expander, .hidden-text-expander a { + color: #d8e2ec; + background: #24292e; + } + .notifications-list-item:hover { + background-color: #24292e!important; + } + .notifications-list-item .notification-list-item-link { + color: #dce2ec!important; + } + .notifications-list-item:hover .notification-list-item-link { + color: #bcd5ff!important; + } + .btn.selected, .btn:active, .btn[aria-selected=true] { + background-color: #424648; + box-shadow: inset 0 1px 0 rgb(31 35 39); + } + .btn-outline.disabled, .btn-outline:disabled, .btn-outline[aria-disabled=true] { + color: rgba(3, 102, 214, .5); + background-color: #24292e; + border-color: rgb(66 67 70 / 0.15); + box-shadow: 0 1px 0 rgba(27, 31, 35, .04), inset 0 1px 0 hsl(0deg 0% 0% / 25%); + } + .form-control[disabled], .form-select[disabled] { + background-color: #24292e; + } + .text-gray-light { + color: #93a4b7!important; + } + .flash { + color: #afcae4; + background-color: rgba(39, 58, 78, .8); + border-color: rgba(4, 66, 137, .2); + backdrop-filter: blur(16px); + } + .form-group .form-control:focus { + background-color: #24292e; + } + .Box-row--hover-gray:hover { + background-color: #2b3035; + } + .TimelineItem--condensed .TimelineItem-badge { + background-color: #24292e; + border-radius: 32px; + border: 2px solid #424346; + color: #d8e2ec; + } + .TimelineItem:before { + background-color: #424346; + } + .signed-commit-badge-large, .signed-commit-badge-medium, .signed-commit-badge-small { + border: 1px solid #6b6c71; + } + .markdown-body img { + background-color: transparent; + } + .blob-code-inner { + color: #dce6f1; + } + .breadcrumb strong.final-path { + color: #d8e2ec; + } + .markdown-body table tr { + background-color: #1f2327; + } + .orghead { + background-color: #24292e; + } + .Label--gray, .Label--outline { + border-color: #768084; + } + .select-menu-filters, .select-menu-header { + background-color: #24292e; + border-bottom: 1px solid #424346; + } + .select-menu-modal { + color: #d8e2ec; + background-color: #24292e; + border: 1px solid #424346; + box-shadow: 0 8px 24px rgb(54 58 62 / 20%); + } + .select-menu-divider, .select-menu-header .select-menu-title { + color: #d8e2ec; + } + .select-menu-item { + background-color: #24292e; + border-bottom: 1px solid #424346; + } + .select-menu-item.selected, details-menu .select-menu-item[aria-checked=true], details-menu .select-menu-item[aria-selected=true] { + color: #68b4ff; + } + .select-menu-item.navigation-focus, .select-menu-item.navigation-focus .description-inline, .select-menu-item.navigation-focus.select-menu-action, .select-menu-item.navigation-focus.selected, .select-menu-item.navigation-focus[aria-checked=true], .select-menu-item:focus, .select-menu-item:focus .description-inline, .select-menu-item:focus.select-menu-action, .select-menu-item:focus.selected, .select-menu-item:hover, .select-menu-item:hover .description-inline, .select-menu-item:hover.select-menu-action, .select-menu-item:hover.selected, .select-menu-item[aria-checked=true]:focus, .select-menu-item[aria-checked=true]:hover, .select-menu-item[aria-selected=true] .description-inline, .select-menu-item[aria-selected=true].select-menu-action, .select-menu-item[aria-selected=true]:focus, .select-menu-item[aria-selected=true]:hover { + background-color: #054690; + } + .menu { + background-color: #24292e; + border: 1px solid #45474a; + } + .menu-heading { + color: #d8e2ec; + border-bottom: 1px solid #45474a; + } + .menu-item { + color: #c6d1dc; + border-color: #424346; + } + .table-list { + border-bottom: 1px solid #424346; + } + .menu-item:focus, .menu-item:hover { + background-color: #34393c; + } + .Header { + color: hsl(0deg 0% 0% / 70%); + } + .header-search-current .header-search-wrapper.focus { + background-color: hsl(0deg 0% 0% / 18%); + } + .header-search-current .jump-to-field-active { + color: #d8e2ec!important; + background-color: #373a3e; + } + .header-search-current .jump-to-suggestions-results-container .navigation-item { + border-bottom: 1px solid #424346; + } + .header-search-current .jump-to-suggestions-path { + color: #d8e2ec; + } + .header-search-current .jump-to-suggestions-results-container .navigation-focus .jump-to-suggestions-path, .header-search-current .jump-to-suggestions-results-container [aria-selected=true] .jump-to-suggestions-path { + background: #054690; + } + .rule, hr { + border-bottom: 1px solid #424346; + } + .file-header { + background-color: #24292e; + border-bottom: 1px solid #424346; + } + .tabnav-tab { + color: #d8e2ec; + } + .tabnav-tab.selected, .tabnav-tab[aria-current]:not([aria-current=false]), .tabnav-tab[aria-selected=true] { + background-color: #24292e; + border-color: #424346; + } + .file { + border: 1px solid #424346; + } + .cm-s-github-light.CodeMirror { + background: #24292e; + color: #d8e2ec; + } + .cm-s-github-light .CodeMirror-gutters { + background: #1f2327; + } + .cm-s-github-light .CodeMirror-lines { + background: #24292e; + } + .cm-s-github-light .cm-string { + color: #96bae4; + } + @media (min-width: 1012px) { + .border-lg-top, .border-lg-left, .border-lg-right, .border-lg-bottom { + border-color: #424346!important; + } + } + .commit-form:before { + border-right-color: #424346; + } + .commit-form:after { + border-right-color: #1f2327; + } + .btn-outline:hover, [open]>.btn-outline { + background-color: #003e84; + } + .timeline-comment { + color: #d8e2ec; + background-color: #24292e; + } + .new-discussion-timeline .composer .comment-form-head.tabnav { + background-color: #24292e; + } + .drag-and-drop { + border-color: #424346; + background-color: #24292e; + } + @media (min-width: 768px) { + .composer.composer-responsive .timeline-comment:before { + border-right-color: #424346; + } + .composer.composer-responsive .timeline-comment:after { + border-right-color: #24292e; + } + .composer.composer-responsive .timeline-comment { + border: 1px solid #424346; + } + .page-responsive .previewable-comment-form .comment-form-head.tabnav { + background: #24292e; + } + .border-md { + border: 1px solid #424346!important; + } + } + .gh-header { + background-color: #1f2327; + } + .gh-header-meta { + border-color: #424346; + } + .discussion-sidebar-item+.discussion-sidebar-item { + border-color: #424346; + } + .timeline-comment, .timeline-comment-header { + border-color: #424346; + } + .timeline-comment-header { + background-color: #24292e; + } + .gh-header .gh-header-sticky.is-stuck+.gh-header-shadow { + background-color: rgb(36 41 46 / 0.8); + border-bottom: 1px solid rgb(255 255 255 / 15%); + backdrop-filter: blur(16px); + } + .pagination-loader-container { + background-color: #1f2327; + background-image: none; + } + .discussion-timeline-actions { + background-color: #1f2327; + border-top: 2px solid #424346; + } + .timeline-comment-wrapper { + border-color: #424346; + } + .pl-k { + color: #ff5565; + } + .pl-e, .pl-en { + color: #8d5fe0; + } + .pl-s .pl-s1, .pl-smi { + color: #cde4fb; + } + .pl-ent { + color: #36ca59; + } + .pl-c1, .pl-s .pl-v { + color: #3f91ef; + } + .subnav-link.selected { + color: #d8e2ec!important; + } + .subnav-link { + color: #b6c0ca; + } + .box-shadow-medium { + box-shadow: 0 3px 6px rgb(31 35 39 / 0.15)!important; + } + .tabnav { + border-color: #424346; + } + .Box-footer { + border-color: #424346; + } + .box-shadow-large { + box-shadow: 0 8px 24px rgb(31 35 39 / 0.2)!important; + } + .Popover-message--bottom-left:after, .Popover-message--bottom-right:after, .Popover-message--bottom:after { + border-top-color: #24292e; + } + .TimelineItem-break { + background-color: #1f2327; + border-color: #424346; + } + .page-responsive .previewable-comment-form .comment-form-head.tabnav .toolbar-commenting { + background: #1f2327; + } + .bg-blue-light { + background-color: #1b3752!important; + } + .setup-info-module { + background-color: #24292e; + border-color: #424346; + } + .setup-info-module h2 { + border-color: #424346; + } + .setup-header { + border-color: #424346; + } + .setup-header .lead { + color: #a9b0b7; + } + .note { + color: #a9b0b7; + } + .select-menu-text-filter input { + border-color: #424346; + } + .select-menu-text-filter:first-child:last-child { + border-color: #424346; + } + .subnav-link:hover { + color: #a9b0b7; + } + .Subhead { + border-color: #424346; + } + mark { + color: #aed6ff; + } + .filter-item { + color: #a9b0b7; + } + .markdown-body table td, .markdown-body table th { + border-color: #424346; + } + .markdown-body table tr:nth-child(2n) { + background-color: #24292e; + } + .markdown-body hr { + background-color: #424346; + } + .codesearch-results .repo-list-item+.repo-list-item { + border-top: 1px solid #424346; + } + .pagination a, .pagination em, .pagination span { + color: #d8e2e6; + } + .site-subnav-sticky { + background-color: rgb(31 35 39 / 0.8)!important; + backdrop-filter: blur(16px); + } + .fade-img-to-white-bg:before { + background: linear-gradient(180deg, #1f2327 0, hsl(210 11% 14% / 0)); + } + .fade-img-to-white-bg:after { + background: linear-gradient(0deg, #1f2327 0, hsl(210 11% 14% / 0)); + } + .Box-row--gray { + background-color: #24292e; + } + .pinned-item-name { + color: #d8e2ec; + } + .pinned-item-checkbox:checked+.pinned-item-name { + color: #6aaaf3; + background-color: #24292e; + } + .tabnav-pr .tabnav-tab { + color: #b8c1cc; + } + .tabnav-pr .tabnav-tab.selected { + color: #d8e2ec; + border-color: #424346; + } + .TimelineItem-body { + color: #d8e2ec; + } + .thread-subscription-status { + background-color: #1f2327; + } + .discussion-sidebar-heading { + color: #d8e2ec; + } + .discussion-sidebar-item { + color: #b2bcc5; + } + .branch-action-body { + background-color: #24292e; + } + .branch-action-state-clean .branch-action-body { + border-color: #2b6538; + } + .merge-status-list { + border-color: #424346; + } + .merge-status-item { + background-color: #24292e; + border-color: #424346; + } + .text-emphasized { + color: #b2bcc5; + } + .status-meta { + color: #b2bcc5; + } + .branch-action-body .merge-branch-form, .branch-action-body .merge-message { + background-color: #24292e; + border-color: #424346; + } + .btn-link { + color: #6aaaf3; + } + .previewable-comment-form .comment-form-head.tabnav { + background: #24292e; + } + .timeline-comment-label { + border-color: #424346; + } + .timeline-comment--caret:before { + border-right-color: #424346; + } + .timeline-comment--caret:after { + border-right-color: #24292e; + } + .diffbar { + background-color: #1f2327; + } + .blob-num-expandable, .blob-num-hunk { + background-color: #24292e; + } + .blob-code-hunk { + background-color: #24292e; + } + .blob-num-addition { + background-color: #2f4032; + border-color: #2f4032; + } + .blob-code-addition { + background-color: #2f4032; + } + .blob-num { + color: rgb(199 227 255 / 30%); + } + .blob-num-deletion { + background-color: #483f40; + border-color: #483f40; + } + .blob-code-deletion { + background-color: #483f40; + } + .pr-toolbar.is-stuck { + background-color: #1f2327; + } + .commit-ref { + background-color: #274466; + } + .timeline-comment.current-user .timeline-comment-header { + background-color: #24292e; + border-bottom-color: #424346; + } + .timeline-comment.current-user { + border-color: #424346; + } + .branch-action-body, .branch-action-state-closed-dirty .branch-action-body, .branch-action-state-dirty .branch-action-body, .is-rebasing .branch-action-state-dirty-if-rebasing .branch-action-body { + border-color: #424346; + } + .branch-action-item+.branch-action-item, .branch-action-item+.mergeability-details { + border-color: #424346; + } + .btn.disabled, .btn:disabled, .btn[aria-disabled=true] { + color: #d8e2ec; + background-color: #292f35; + } + .discussion-timeline.team-discussion-timeline .blankslate { + background: #24292e; + } + .range-editor { + background-color: #24292e; + border-color: #424346; + } + .file-diff-split .blob-code+.blob-num { + border-color: #424346; + } + .table-list-header { + background-color: #24292e; + border-color: #424346; + } + .table-list { + border-color: #424346; + } + .table-list-bordered .table-list-cell:first-child { + border-color: #424346; + } + .table-list-bordered .table-list-cell:last-child { + border-color: #424346; + } + .table-list-cell { + border-color: #424346; + } + .orgs-help-shelf { + border-color: #424346; + } + .orgs-help-item-octicon { + background-color: #24292e; + border-color: #424346; + } + .review-thread-reply { + background-color: #24292e; + border-color: #424346; + } + .discussion-post .timeline-inline-comments { + background: transparent; + } + .task-progress .progress-bar { + background-color: #424346; + } + .markdown-body blockquote { + border-color: #424346; + } + .review-thread-reply { + background-color: #24292e; + border-color: #424346; + } + .TimelineItem-badge { + color: #d8e2ec; + background-color: #24292e; + border-color: #424346; + } + .review-comment .reaction-summary-item:not(.add-reaction-btn) { + border-color: #424346; + } + .copyable-terminal { + background-color: #1f2327; + } + .review-thread-reply .inline-comment-form { + background-color: #24292e; + } + .form-group.errored .error { + background-color: #463434; + border-color: #77454b; + } + .home-enterprise-wrapper:before { + background-color: #2b3137; + } + .timeline-comment--caret.current-user:before { + border-right-color: #424346; + } + .timeline-comment--caret.current-user:after { + border-right-color: #24292e; + } + .timeline-comment.current-user .timeline-comment-label { + border-color: #424346; + } + .project-column { + background-color: #24292E; + } + .project-card:hover { + border-color: #727479!important; + } + .comment-reactions.has-reactions { + border-color: #424346; + } + .reaction-summary-item { + border-color: #424346; + } + .project-pane { + background-color: rgba(36, 41, 46, 0.8)!important; + backdrop-filter: blur(16px); + } + .project-issue-body-blur { + background: linear-gradient(0deg, #23282d, hsl(210deg 12% 16% / 0%)); + } + .comment-reactions.has-reactions { + border-color: #424346; + } + .comment-reactions .user-has-reacted { + background-color: #24292e; + } + .reaction-summary-item { + border-color: #424346; + } + .full-commit { + background: #24292e; + border-color: #424346; + } + .full-commit p.commit-title { + color: #acc3da; + } + .full-commit .commit-meta { + background: #1f2327; + border-color: #424346; + } + .commit-sha { + background-color: #24292e; + border-color: #424346; + } + .thread-subscription-status { + border-color: #424346; + } + .upload-enabled textarea { + border-color: #424346; + } + @media (min-width: 768px) { + .border-md-top { + border-color: #424346!important; + } + } + .discussion-post .reply-comment:first-child { + border-color: #424346; + } + .discussion-post .reply-comments-holder:before { + background-color: #424346; + } + .review-comment { + color: #d8e2ec; + } + .notifications-list-item.notification-unread { + background-color: #24292e; + } + .notifications-list-item.notification-unread .notification-list-item-link { + color: #d8e2ec!important; + } + .timeline-comment-header { + color: #d8e2ec; + } + .Popover-message:after { + border-bottom-color: #24292e; + } + .Popover-message:before { + border-bottom-color: #424346; + } + .file-diff-split .empty-cell { + background-color: #24292E; + } + .diff-table tr:not(:last-child) .line-comments { + border-color: #424346; + } + .inline-comment-form { + border-color: #424346; + } + .CheckRun-header { + border-top-color: #424346; + } + .commit-ref { + color: #6aaaf3; + } + .commit-ref .user { + color: #6aaaf3; + } + .user-status-circle-badge { + background-color: #24292e; + border-color: #424346; + } + .session-authentication { + background-color: #1f2327; + } + .session-authentication .auth-form-header { + color: #d8e2ec; + } + .auth-form-body { + background-color: #24292E; + border-color: #424346; + } + .session-authentication .auth-form-body { + border-color: #424346; + } + .subnav-bordered { + border-color: #424346; + } + .org-user-notice-content strong { + color: #fff; + } + .markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { + color: #c7d2de; + } + .border-left { + border-left: 1px solid #424346!important; + } + .SelectMenu-footer { + border-color: #424346; + } + .SelectMenu-tabs { + box-shadow: inset 0 -1px 0 #424346; + } + .SelectMenu-tab { + box-shadow: inset 0 -1px 0 #424346; + } + .SelectMenu-tab[aria-selected=true] { + color: #d8e2ec; + background-color: #24292e; + box-shadow: 0 0 0 1px #424346; + } + @media (min-width: 544px) { + .SelectMenu-tab[aria-selected=true] { + border-color: #424346; + } + } + @media (hover: hover) { + .SelectMenu-tab:hover { + color: #d8e2ec; + } + } + .SelectMenu-message { + background-color: #24292e; + border-bottom: 1px solid #424346; + } + .AvatarStack-body { + background: transparent; + } + .branch-name { + background-color: #274466; + } + a.branch-name { + color: #6aaaf3; + } +}`; + // Append to + body.appendChild(style); + + // If at Explore page + if (window.location.href.match('https://github.com/explore*') || window.location.href.match('https://github.com/topics*')) { + // Select the white background and replace it + document.querySelector(".border-bottom.border-gray-light").setAttribute("style", ""); + // Set `explorePageTopicsGradientMaskSelector` to the selector of the recommandation list + var explorePageTopicsGradientMaskSelector = '[style="background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));"]'; + // Edit its mask then + for ( + let ele = document.querySelector(explorePageTopicsGradientMaskSelector); + document.querySelector(explorePageTopicsGradientMaskSelector); + ele = document.querySelector(explorePageTopicsGradientMaskSelector) + ) { + ele.style.background = "linear-gradient(to top, rgb(31 35 39), rgb(31 35 39 / 0))" + } + // If on topic page + if (window.location.href.match('https://github.com/topics*')) { + document.querySelector('[style="background-color: #fcfdfd;"]').style.backgroundColor = '#1F2327'; } + } - console.log('GitHub Dark Mode initialized') - } else { - console.log("GitHub Dark Mode is off because your browser isn't in dark mode") - } - })((() => { - if (window.matchMedia('(prefers-color-scheme)').media == 'not all') { - console.log("GitHub Dark Mode didn't launch because your browser doesn't support dark mode"); - return false - } else { - return window.matchMedia('(prefers-color-scheme: dark)').matches - } - })()); -}); + // If at Sponsors page + if (window.location.href.match('https://github.com/sponsors*')) { + // Select the gradient cover and replace it + document.querySelector('[style="height: 100%; background: linear-gradient(to bottom, rgba(246,248,250,0.5) 0%,rgba(246,248,250,1) 100%);"]').setAttribute("style", "height: 100%; background: linear-gradient(to bottom, rgba(31, 35, 39, 0.5) 0%,rgba(31, 35, 39, 1) 100%);"); + } + console.log('GitHub Dark Mode initialized') + } else { + console.log("GitHub Dark Mode is off because your browser isn't in dark mode") + } +})((() => { + if (window.matchMedia('(prefers-color-scheme)').media == 'not all') { + console.log("GitHub Dark Mode didn't launch because your browser doesn't support dark mode"); + return false + } else { + return window.matchMedia('(prefers-color-scheme: dark)').matches + } +})()); diff --git a/GitHubDarkMode Extension/zh-Hans.lproj/SafariExtensionViewController.strings b/GitHubDarkMode Extension/zh-Hans.lproj/SafariExtensionViewController.strings deleted file mode 100644 index 6717b12..0000000 --- a/GitHubDarkMode Extension/zh-Hans.lproj/SafariExtensionViewController.strings +++ /dev/null @@ -1,3 +0,0 @@ - -/* Class = "NSTextFieldCell"; title = "GitHubDarkMode Extension"; ObjectID = "2Ec-kd-q2K"; */ -"2Ec-kd-q2K.title" = "GitHubDarkMode Extension"; diff --git a/GitHubDarkMode.xcodeproj/project.pbxproj b/GitHubDarkMode.xcodeproj/project.pbxproj index e9d90a5..0cc0b17 100644 --- a/GitHubDarkMode.xcodeproj/project.pbxproj +++ b/GitHubDarkMode.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 53; objects = { /* Begin PBXBuildFile section */ @@ -15,10 +15,7 @@ BF4F7E0324F4C33E009EF13B /* GitHubDarkMode Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = BF4F7E0224F4C33E009EF13B /* GitHubDarkMode Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; BF4F7E0824F4C33E009EF13B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4F7E0724F4C33E009EF13B /* Cocoa.framework */; }; BF4F7E0B24F4C33E009EF13B /* SafariExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF4F7E0A24F4C33E009EF13B /* SafariExtensionHandler.swift */; }; - BF4F7E0D24F4C33E009EF13B /* SafariExtensionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF4F7E0C24F4C33E009EF13B /* SafariExtensionViewController.swift */; }; - BF4F7E1024F4C33E009EF13B /* SafariExtensionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF4F7E0E24F4C33E009EF13B /* SafariExtensionViewController.xib */; }; BF4F7E1324F4C33E009EF13B /* script.js in Resources */ = {isa = PBXBuildFile; fileRef = BF4F7E1224F4C33E009EF13B /* script.js */; }; - BF4F7E1524F4C33E009EF13B /* ToolbarItemIcon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = BF4F7E1424F4C33E009EF13B /* ToolbarItemIcon.pdf */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -46,6 +43,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 075C15B2254000F50098F1C2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; + 075C15BB2540039E0098F1C2 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = ""; }; BF4F7DEF24F4C33D009EF13B /* GitHubDarkMode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GitHubDarkMode.app; sourceTree = BUILT_PRODUCTS_DIR; }; BF4F7DF224F4C33D009EF13B /* GitHubDarkMode.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GitHubDarkMode.entitlements; sourceTree = ""; }; BF4F7DF424F4C33D009EF13B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -56,14 +55,10 @@ BF4F7E0224F4C33E009EF13B /* GitHubDarkMode Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "GitHubDarkMode Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; BF4F7E0724F4C33E009EF13B /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; BF4F7E0A24F4C33E009EF13B /* SafariExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariExtensionHandler.swift; sourceTree = ""; }; - BF4F7E0C24F4C33E009EF13B /* SafariExtensionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariExtensionViewController.swift; sourceTree = ""; }; - BF4F7E0F24F4C33E009EF13B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SafariExtensionViewController.xib; sourceTree = ""; }; BF4F7E1124F4C33E009EF13B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BF4F7E1224F4C33E009EF13B /* script.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = script.js; sourceTree = ""; }; - BF4F7E1424F4C33E009EF13B /* ToolbarItemIcon.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = ToolbarItemIcon.pdf; sourceTree = ""; }; BF4F7E1624F4C33E009EF13B /* GitHubDarkMode_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GitHubDarkMode_Extension.entitlements; sourceTree = ""; }; BFCCD0FE24F4CDA500826EBB /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; - BFCCD0FF24F4CDA500826EBB /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/SafariExtensionViewController.strings"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -129,11 +124,8 @@ isa = PBXGroup; children = ( BF4F7E0A24F4C33E009EF13B /* SafariExtensionHandler.swift */, - BF4F7E0C24F4C33E009EF13B /* SafariExtensionViewController.swift */, - BF4F7E0E24F4C33E009EF13B /* SafariExtensionViewController.xib */, BF4F7E1124F4C33E009EF13B /* Info.plist */, BF4F7E1224F4C33E009EF13B /* script.js */, - BF4F7E1424F4C33E009EF13B /* ToolbarItemIcon.pdf */, BF4F7E1624F4C33E009EF13B /* GitHubDarkMode_Extension.entitlements */, ); path = "GitHubDarkMode Extension"; @@ -184,8 +176,9 @@ BF4F7DE724F4C33D009EF13B /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1160; - LastUpgradeCheck = 1160; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = "Louis Studio"; TargetAttributes = { BF4F7DEE24F4C33D009EF13B = { @@ -197,13 +190,14 @@ }; }; buildConfigurationList = BF4F7DEA24F4C33D009EF13B /* Build configuration list for PBXProject "GitHubDarkMode" */; - compatibilityVersion = "Xcode 9.3"; + compatibilityVersion = "Xcode 11.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, "zh-Hans", + de, ); mainGroup = BF4F7DE624F4C33D009EF13B; productRefGroup = BF4F7DF024F4C33D009EF13B /* Products */; @@ -231,8 +225,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - BF4F7E1524F4C33E009EF13B /* ToolbarItemIcon.pdf in Resources */, - BF4F7E1024F4C33E009EF13B /* SafariExtensionViewController.xib in Resources */, BF4F7E1324F4C33E009EF13B /* script.js in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -253,7 +245,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BF4F7E0D24F4C33E009EF13B /* SafariExtensionViewController.swift in Sources */, BF4F7E0B24F4C33E009EF13B /* SafariExtensionHandler.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -274,19 +265,12 @@ children = ( BF4F7DF724F4C33D009EF13B /* Base */, BFCCD0FE24F4CDA500826EBB /* zh-Hans */, + 075C15B2254000F50098F1C2 /* en */, + 075C15BB2540039E0098F1C2 /* de */, ); name = Main.storyboard; sourceTree = ""; }; - BF4F7E0E24F4C33E009EF13B /* SafariExtensionViewController.xib */ = { - isa = PBXVariantGroup; - children = ( - BF4F7E0F24F4C33E009EF13B /* Base */, - BFCCD0FF24F4CDA500826EBB /* zh-Hans */, - ); - name = SafariExtensionViewController.xib; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -317,6 +301,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -378,6 +363,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -409,7 +395,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_ENTITLEMENTS = "GitHubDarkMode Extension/GitHubDarkMode_Extension.entitlements"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = N5R4643XP6; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "GitHubDarkMode Extension/Info.plist"; @@ -418,6 +406,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); + MARKETING_VERSION = 0.1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.louisstudio.GitHubDarkMode-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -429,7 +418,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_ENTITLEMENTS = "GitHubDarkMode Extension/GitHubDarkMode_Extension.entitlements"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = N5R4643XP6; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "GitHubDarkMode Extension/Info.plist"; @@ -438,6 +429,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); + MARKETING_VERSION = 0.1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.louisstudio.GitHubDarkMode-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -451,8 +443,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = GitHubDarkMode/GitHubDarkMode.entitlements; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = N5R4643XP6; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = GitHubDarkMode/Info.plist; @@ -460,6 +454,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MARKETING_VERSION = 0.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.louisstudio.GitHubDarkMode; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -472,8 +467,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = GitHubDarkMode/GitHubDarkMode.entitlements; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = N5R4643XP6; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = GitHubDarkMode/Info.plist; @@ -481,6 +478,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MARKETING_VERSION = 0.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.louisstudio.GitHubDarkMode; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/GitHubDarkMode.xcodeproj/xcshareddata/xcschemes/GitHubDarkMode Extension.xcscheme b/GitHubDarkMode.xcodeproj/xcshareddata/xcschemes/GitHubDarkMode Extension.xcscheme index cda9cbc..4911f71 100644 --- a/GitHubDarkMode.xcodeproj/xcshareddata/xcschemes/GitHubDarkMode Extension.xcscheme +++ b/GitHubDarkMode.xcodeproj/xcshareddata/xcschemes/GitHubDarkMode Extension.xcscheme @@ -1,6 +1,6 @@ - + - + + @@ -150,13 +151,10 @@ DQ - - - - + diff --git a/GitHubDarkMode/Info.plist b/GitHubDarkMode/Info.plist index 0a217d6..f1f48e7 100644 --- a/GitHubDarkMode/Info.plist +++ b/GitHubDarkMode/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 0.1.0 + $(MARKETING_VERSION) CFBundleVersion - 1 + $(CURRENT_PROJECT_VERSION) LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/GitHubDarkMode/ViewController.swift b/GitHubDarkMode/ViewController.swift index 467d52a..c3415d2 100644 --- a/GitHubDarkMode/ViewController.swift +++ b/GitHubDarkMode/ViewController.swift @@ -8,23 +8,18 @@ import Cocoa import SafariServices.SFSafariApplication +import os -class ViewController: NSViewController { - - @IBOutlet var appNameLabel: NSTextField! - - override func viewDidLoad() { - super.viewDidLoad() - self.appNameLabel.stringValue = "GitHub Dark Mode"; - } - +final class ViewController: NSViewController { @IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) { SFSafariApplication.showPreferencesForExtension(withIdentifier: "com.louisstudio.GitHubDarkMode-Extension") { error in - if let _ = error { + if let error = error { // Insert code to inform the user that something went wrong. - + os_log("Failed to show safari preferences: %@", String(describing: error)) + DispatchQueue.main.async { + self.presentError(error) + } } } } - } diff --git a/GitHubDarkMode/de.lproj/Main.strings b/GitHubDarkMode/de.lproj/Main.strings new file mode 100644 index 0000000..40eacdf --- /dev/null +++ b/GitHubDarkMode/de.lproj/Main.strings @@ -0,0 +1,45 @@ + +/* Class = "NSMenuItem"; title = "GitHub Dark Mode"; ObjectID = "1Xt-HY-uBw"; */ +"1Xt-HY-uBw.title" = "GitHub Dark Mode"; + +/* Class = "NSMenuItem"; title = "Quit GitHub Dark Mode"; ObjectID = "4sb-4s-VLi"; */ +"4sb-4s-VLi.title" = "GitHub Dark Mode beenden"; + +/* Class = "NSMenuItem"; title = "About GitHub Dark Mode"; ObjectID = "5kV-Vb-QxS"; */ +"5kV-Vb-QxS.title" = "Über GitHub Dark Mode"; + +/* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */ +"AYu-sK-qS6.title" = "Hauptmenü"; + +/* Class = "NSMenu"; title = "Help"; ObjectID = "F2S-fz-NVQ"; */ +"F2S-fz-NVQ.title" = "Hilfe"; + +/* Class = "NSMenuItem"; title = "GitHub Dark Mode Help"; ObjectID = "FKE-Sm-Kum"; */ +"FKE-Sm-Kum.title" = "GitHub Dark Mode Hilfe"; + +/* Class = "NSWindow"; title = "GitHub Dark Mode"; ObjectID = "IQv-IB-iLA"; */ +"IQv-IB-iLA.title" = "GitHub Dark Mode"; + +/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "Kd2-mp-pUS"; */ +"Kd2-mp-pUS.title" = "Alle anzeigen"; + +/* Class = "NSMenuItem"; title = "Hide GitHub Dark Mode"; ObjectID = "Olw-nP-bQN"; */ +"Olw-nP-bQN.title" = "GitHub Dark Mode ausblenden"; + +/* Class = "NSTextFieldCell"; title = "GitHub Dark Mode"; ObjectID = "S7v-7o-3vW"; */ +"S7v-7o-3vW.title" = "GitHub Dark Mode"; + +/* Class = "NSButtonCell"; alternateTitle = "Install"; ObjectID = "Srx-0j-A4D"; */ +"Srx-0j-A4D.alternateTitle" = "Installieren"; + +/* Class = "NSButtonCell"; title = "Open in Safari Extensions Preferences…"; ObjectID = "Srx-0j-A4D"; */ +"Srx-0j-A4D.title" = "In Safari's Erweiterungen Einstellungen öffenen…"; + +/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "Vdr-fp-XzO"; */ +"Vdr-fp-XzO.title" = "Andere ausblenden"; + +/* Class = "NSMenu"; title = "GitHub Dark Mode"; ObjectID = "uQy-DD-JDr"; */ +"uQy-DD-JDr.title" = "GitHub Dark Mode"; + +/* Class = "NSMenuItem"; title = "Help"; ObjectID = "wpr-3q-Mcd"; */ +"wpr-3q-Mcd.title" = "Hilfe";