Implement a way to distribute themes with NetNewsWire
This commit is contained in:
parent
020c1f6141
commit
9851629ec9
|
@ -190,6 +190,11 @@
|
|||
51107746243BEE2500D97C8C /* ExtensionPointPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51107745243BEE2500D97C8C /* ExtensionPointPreferencesViewController.swift */; };
|
||||
51107747243BEE2500D97C8C /* ExtensionPointPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51107745243BEE2500D97C8C /* ExtensionPointPreferencesViewController.swift */; };
|
||||
5110C37D2373A8D100A9C04F /* InspectorIconHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5110C37C2373A8D100A9C04F /* InspectorIconHeaderView.swift */; };
|
||||
5112435026EE629A002601D2 /* Sepia.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 5112434F26EE6291002601D2 /* Sepia.nnwtheme */; };
|
||||
5112435126EE629B002601D2 /* Sepia.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 5112434F26EE6291002601D2 /* Sepia.nnwtheme */; };
|
||||
5112435226EE629C002601D2 /* Sepia.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 5112434F26EE6291002601D2 /* Sepia.nnwtheme */; };
|
||||
5112435326EE629F002601D2 /* Sepia.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 5112434F26EE6291002601D2 /* Sepia.nnwtheme */; };
|
||||
5112435426EE629F002601D2 /* Sepia.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 5112434F26EE6291002601D2 /* Sepia.nnwtheme */; };
|
||||
51126DA4225FDE2F00722696 /* RSImage-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51126DA3225FDE2F00722696 /* RSImage-Extensions.swift */; };
|
||||
5117715524E1EA0F00A2A836 /* ArticleExtractorButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5117715424E1EA0F00A2A836 /* ArticleExtractorButton.swift */; };
|
||||
5117715624E1EA0F00A2A836 /* ArticleExtractorButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5117715424E1EA0F00A2A836 /* ArticleExtractorButton.swift */; };
|
||||
|
@ -1623,6 +1628,7 @@
|
|||
51107745243BEE2500D97C8C /* ExtensionPointPreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionPointPreferencesViewController.swift; sourceTree = "<group>"; };
|
||||
5110C37C2373A8D100A9C04F /* InspectorIconHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InspectorIconHeaderView.swift; sourceTree = "<group>"; };
|
||||
51121AA12265430A00BC0EC1 /* NetNewsWire_iOSapp_target.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = NetNewsWire_iOSapp_target.xcconfig; sourceTree = "<group>"; };
|
||||
5112434F26EE6291002601D2 /* Sepia.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Sepia.nnwtheme; sourceTree = "<group>"; };
|
||||
51126DA3225FDE2F00722696 /* RSImage-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RSImage-Extensions.swift"; sourceTree = "<group>"; };
|
||||
5117715424E1EA0F00A2A836 /* ArticleExtractorButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleExtractorButton.swift; sourceTree = "<group>"; };
|
||||
511B9805237DCAC90028BCAA /* UserInfoKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoKey.swift; sourceTree = "<group>"; };
|
||||
|
@ -3696,6 +3702,7 @@
|
|||
84C9FC9C2262A1A900D921D6 /* Info.plist */,
|
||||
84BB0F812333426400DED65E /* NetNewsWire.entitlements */,
|
||||
51F805ED24284C1C0022C792 /* NetNewsWire-dev.entitlements */,
|
||||
5112434F26EE6291002601D2 /* Sepia.nnwtheme */,
|
||||
);
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
|
@ -4385,6 +4392,7 @@
|
|||
51E4995F24A875F300B667CB /* stylesheet.css in Resources */,
|
||||
517B2EE824B3E8FE001AC46C /* main_multiplatform.js in Resources */,
|
||||
51E4997324A8784300B667CB /* DefaultFeeds.opml in Resources */,
|
||||
5112435326EE629F002601D2 /* Sepia.nnwtheme in Resources */,
|
||||
51C0516224A77DF800194D5E /* Assets.xcassets in Resources */,
|
||||
5177475F24B39AD500EB0F74 /* About.rtf in Resources */,
|
||||
51E4996024A875F300B667CB /* template.html in Resources */,
|
||||
|
@ -4403,6 +4411,7 @@
|
|||
files = (
|
||||
517B2EE324B3E8FE001AC46C /* page.html in Resources */,
|
||||
51E4996424A875F400B667CB /* stylesheet.css in Resources */,
|
||||
5112435426EE629F002601D2 /* Sepia.nnwtheme in Resources */,
|
||||
51E4997524A8784400B667CB /* DefaultFeeds.opml in Resources */,
|
||||
51C0516324A77DF800194D5E /* Assets.xcassets in Resources */,
|
||||
51E4996524A875F400B667CB /* template.html in Resources */,
|
||||
|
@ -4444,6 +4453,7 @@
|
|||
65ED4051235DEF6C0081F399 /* TimelineKeyboardShortcuts.plist in Resources */,
|
||||
65ED4052235DEF6C0081F399 /* template.html in Resources */,
|
||||
65ED4054235DEF6C0081F399 /* Main.storyboard in Resources */,
|
||||
5112435126EE629B002601D2 /* Sepia.nnwtheme in Resources */,
|
||||
65ED4056235DEF6C0081F399 /* NetNewsWire.sdef in Resources */,
|
||||
65ED4057235DEF6C0081F399 /* AccountsDetail.xib in Resources */,
|
||||
65ED4058235DEF6C0081F399 /* main.js in Resources */,
|
||||
|
@ -4495,6 +4505,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5112435226EE629C002601D2 /* Sepia.nnwtheme in Resources */,
|
||||
517630052336215100E15FFF /* main.js in Resources */,
|
||||
5148F44B2336DB4700F8CD8B /* MasterTimelineTitleView.xib in Resources */,
|
||||
511D43D0231FA62500FB1562 /* TimelineKeyboardShortcuts.plist in Resources */,
|
||||
|
@ -4543,6 +4554,7 @@
|
|||
848363082262A3DD00DA1D35 /* Main.storyboard in Resources */,
|
||||
84C9FC8F22629E8F00D921D6 /* NetNewsWire.sdef in Resources */,
|
||||
84C9FC7D22629E1200D921D6 /* AccountsDetail.xib in Resources */,
|
||||
5112435026EE629A002601D2 /* Sepia.nnwtheme in Resources */,
|
||||
517630042336215100E15FFF /* main.js in Resources */,
|
||||
65ED40A0235DEFF00081F399 /* container-migration.plist in Resources */,
|
||||
5144EA362279FC3D00D19003 /* AccountsAddLocal.xib in Resources */,
|
||||
|
|
|
@ -61,6 +61,15 @@ final class ArticleThemesManager: NSObject, NSFilePresenter {
|
|||
abort()
|
||||
}
|
||||
|
||||
let themeFilenames = Bundle.main.paths(forResourcesOfType: ArticleTheme.nnwThemeSuffix, inDirectory: nil)
|
||||
let installedStyleSheets = readInstalledStyleSheets() ?? [String: Date]()
|
||||
for themeFilename in themeFilenames {
|
||||
let themeName = ArticleTheme.themeNameForPath(themeFilename)
|
||||
if !installedStyleSheets.keys.contains(themeName) {
|
||||
try? importTheme(filename: themeFilename)
|
||||
}
|
||||
}
|
||||
|
||||
updateThemeNames()
|
||||
updateCurrentTheme()
|
||||
|
||||
|
@ -89,6 +98,11 @@ final class ArticleThemesManager: NSObject, NSFilePresenter {
|
|||
}
|
||||
|
||||
try FileManager.default.copyItem(atPath: filename, toPath: toFilename)
|
||||
|
||||
let themeName = ArticleTheme.themeNameForPath(filename)
|
||||
var installedStyleSheets = readInstalledStyleSheets() ?? [String: Date]()
|
||||
installedStyleSheets[themeName] = Date()
|
||||
writeInstalledStyleSheets(installedStyleSheets)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -153,4 +167,14 @@ private extension ArticleThemesManager {
|
|||
return nil
|
||||
}
|
||||
|
||||
func readInstalledStyleSheets() -> [String: Date]? {
|
||||
let filePath = (folderPath as NSString).appendingPathComponent("InstalledStyleSheets.plist")
|
||||
return NSDictionary(contentsOfFile: filePath) as? [String: Date]
|
||||
}
|
||||
|
||||
func writeInstalledStyleSheets(_ dict: [String: Date]) {
|
||||
let filePath = (folderPath as NSString).appendingPathComponent("InstalledStyleSheets.plist")
|
||||
(dict as NSDictionary).write(toFile: filePath, atomically: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Name</key>
|
||||
<string>Sepia</string>
|
||||
<key>ThemeIdentifer</key>
|
||||
<string>com.netnewswire.themes.sepia</string>
|
||||
<key>CreatorHomePage</key>
|
||||
<string>http://netnewswire.com/</string>
|
||||
<key>CreatorName</key>
|
||||
<string>Ranchero Software</string>
|
||||
<key>Version</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,405 @@
|
|||
/* Shared iOS and macOS CSS rules. Platform specific rules are at the bottom of this file. */
|
||||
|
||||
body {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
word-wrap: break-word;
|
||||
max-width: 44em;
|
||||
background-color: #FBF0D9;
|
||||
color: #704214;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.feedlink {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.headerTable {
|
||||
width: 100%;
|
||||
height: 68px;
|
||||
}
|
||||
|
||||
.systemMessage {
|
||||
position: absolute;
|
||||
top: 45%;
|
||||
left: 50%;
|
||||
transform: translateX(-55%) translateY(-50%);
|
||||
-webkit-user-select: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
:root {
|
||||
--header-table-border-color: rgba(0, 0, 0, 0.3);
|
||||
--header-color: rgba(0, 0, 0, 0.5);
|
||||
--body-code-color: #704214;
|
||||
--system-message-color: #704214;
|
||||
--feedlink-color: rgba(255, 0, 0, 0.6);
|
||||
--article-title-color: #704214;
|
||||
--article-date-color: rgba(0, 0, 0, 0.5);
|
||||
--table-cell-border-color: lightgray;
|
||||
--primary-accent-color: #43350E;
|
||||
--secondary-accent-color: #43350E;
|
||||
--block-quote-border-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
body a, body a:visited {
|
||||
text-decoration: underline;
|
||||
color: var(--secondary-accent-color);
|
||||
}
|
||||
|
||||
|
||||
body .headerTable {
|
||||
border-bottom: 1px solid var(--header-table-border-color);
|
||||
color: var(--header-color);
|
||||
}
|
||||
|
||||
body .header {
|
||||
color: var(--header-color);
|
||||
}
|
||||
|
||||
body .header a:link, .header a:visited {
|
||||
color: var(--header-color);
|
||||
}
|
||||
|
||||
body code, body pre {
|
||||
color: var(--body-code-color);
|
||||
}
|
||||
|
||||
body > .systemMessage {
|
||||
color: var(--system-message-color);
|
||||
}
|
||||
|
||||
.feedlink a:link, .feedlink a:visited {
|
||||
color: var(--feedlink-color);
|
||||
}
|
||||
|
||||
.avatar img {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.feedIcon {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.rightAlign {
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.leftAlign {
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
.articleTitle a:link, .articleTitle a:visited {
|
||||
color: var(--article-title-color);
|
||||
margin-top: 26px;
|
||||
}
|
||||
|
||||
.articleDateline {
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.articleDateline a:link, .articleDateline a:visited {
|
||||
color: var(--article-date-color);
|
||||
}
|
||||
|
||||
.articleDatelineTitle {
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.articleDatelineTitle a:link, .articleDatelineTitle a:visited {
|
||||
color: var(--article-title-color);
|
||||
}
|
||||
|
||||
.externalLink {
|
||||
margin-bottom: 5px;
|
||||
font-style: italic;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.articleBody {
|
||||
margin-top: 20px;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
line-height: 1.15em;
|
||||
font-weight: bold;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
pre {
|
||||
max-width: 100%;
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
overflow-y: hidden;
|
||||
word-wrap: normal;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
pre {
|
||||
line-height: 1.4286em;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
font-family: "SF Mono", Menlo, "Courier New", Courier, monospace;
|
||||
font-size: 1em;
|
||||
-webkit-hyphens: none;
|
||||
}
|
||||
|
||||
pre code {
|
||||
letter-spacing: -.027em;
|
||||
font-size: 0.9375em;
|
||||
}
|
||||
|
||||
.nnw-overflow {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
Instead of the last-child bits, border-collapse: collapse
|
||||
could have been used. However, then the inter-cell borders
|
||||
overlap the table border, which looks bad.
|
||||
*/
|
||||
.nnw-overflow table {
|
||||
margin-bottom: 1px;
|
||||
border-spacing: 0;
|
||||
border: 1px solid var(--secondary-accent-color);
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
.nnw-overflow table table {
|
||||
margin-bottom: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.nnw-overflow td, .nnw-overflow th {
|
||||
-webkit-hyphens: none;
|
||||
word-break: normal;
|
||||
border: 1px solid var(--table-cell-border-color);
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.nnw-overflow tr :matches(td, th):last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.nnw-overflow :matches(thead, tbody, tfoot):last-child > tr:last-child :matches(td, th) {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.nnw-overflow td pre {
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.nnw-overflow table[border="0"] {
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
img, figure, video, div, object {
|
||||
max-width: 100%;
|
||||
height: auto !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
iframe {
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
iframe.nnw-constrained {
|
||||
max-height: 50vw;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin-bottom: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
font-size: 14px;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
sup {
|
||||
vertical-align: top;
|
||||
position: relative;
|
||||
bottom: 0.2rem;
|
||||
}
|
||||
|
||||
sub {
|
||||
vertical-align: bottom;
|
||||
position: relative;
|
||||
top: 0.2rem;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 1.5px solid var(--table-cell-border-color);
|
||||
}
|
||||
|
||||
.iframeWrap {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding-top: 56.25%;
|
||||
}
|
||||
|
||||
.iframeWrap iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-inline-start: 0;
|
||||
margin-inline-end: 0;
|
||||
padding-inline-start: 15px;
|
||||
border-inline-start: 3px solid var(--block-quote-border-color);
|
||||
}
|
||||
|
||||
/* Feed Specific */
|
||||
|
||||
.feedbin--article-wrap {
|
||||
border-top: 1px solid var(--header-table-border-color);
|
||||
}
|
||||
|
||||
/* Twitter */
|
||||
|
||||
.twitterAvatar {
|
||||
vertical-align: middle;
|
||||
border-radius: 4px;
|
||||
height: 1.7em;
|
||||
width: 1.7em;
|
||||
}
|
||||
|
||||
.twitterUsername {
|
||||
line-height: 1.2;
|
||||
margin-left: 4px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.twitterScreenName {
|
||||
font-size: 66%;
|
||||
}
|
||||
|
||||
.twitterTimestamp {
|
||||
font-size: 66%;
|
||||
}
|
||||
|
||||
/* Newsfoot theme for light mode (default) */
|
||||
.newsfoot-footnote-popover {
|
||||
background: #ccc;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.25);
|
||||
color: #704214;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.newsfoot-footnote-popover-arrow {
|
||||
background: #FBF0D9;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.newsfoot-footnote-popover-inner {
|
||||
background: #FBF0D9;
|
||||
}
|
||||
|
||||
body a.footnote,
|
||||
body a.footnote:visited,
|
||||
.newsfoot-footnote-popover + a.footnote:hover {
|
||||
background: #aaa;
|
||||
color: white;
|
||||
transition: background-color 200ms ease-out;
|
||||
}
|
||||
|
||||
a.footnote:hover,
|
||||
.newsfoot-footnote-popover + a.footnote {
|
||||
background: #666;
|
||||
transition: background-color 200ms ease-out;
|
||||
}
|
||||
|
||||
/* iOS Specific */
|
||||
@supports (-webkit-touch-callout: none) {
|
||||
|
||||
body {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
|
||||
word-break: break-word;
|
||||
-webkit-hyphens: auto;
|
||||
-webkit-text-size-adjust: none;
|
||||
font: Georgia;
|
||||
font-size: [[font-size]]px;
|
||||
}
|
||||
|
||||
pre {
|
||||
border: 1px solid var(--secondary-accent-color);
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.nnw-overflow table {
|
||||
border: 1px solid var(--secondary-accent-color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* macOS Specific */
|
||||
@supports not (-webkit-touch-callout: none) {
|
||||
|
||||
body {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 64px;
|
||||
padding-left: 48px;
|
||||
padding-right: 48px;
|
||||
font-family: Georgia;
|
||||
}
|
||||
|
||||
.smallText {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.mediumText {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.largeText {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.xlargeText {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.xxlargeText {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
pre {
|
||||
border: 1px solid var(--primary-accent-color);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.nnw-overflow table {
|
||||
border: 1px solid var(--primary-accent-color);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<header class="headerContainer">
|
||||
<table cellpadding=0 cellspacing=0 border=0 class="headerTable">
|
||||
<tr>
|
||||
<td class="header leftAlign"><span class="feedlink">[[feedlink]]</span><br />[[byline]]</td>
|
||||
[[avatars]]
|
||||
</tr>
|
||||
</table>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="articleTitle"><h1>[[title]]</h1></div>
|
||||
<div class="[[dateline_style]]">[[date_medium]]</div>
|
||||
<div class="externalLink">[[external_link]]</div>
|
||||
<div id="bodyContainer" class="articleBody [[text_size_class]]">[[body]]</div>
|
||||
</article>
|
Loading…
Reference in New Issue