sfc-utils 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/blueconic.js +58 -0
- package/brands.js +180 -0
- package/copy/c2p_sheet.js +186 -0
- package/copy/docs.js +177 -0
- package/copy/googleauth.js +153 -0
- package/copy/sheets.js +151 -0
- package/fonts/albany.less +45 -0
- package/fonts/default.less +50 -0
- package/fonts/houston.less +51 -0
- package/fonts/sfc.less +57 -0
- package/footer.js +615 -0
- package/index.js +254 -0
- package/nav.js +247 -0
- package/package.json +14 -0
- package/settings.js +86 -0
- package/specialnav.js +128 -0
- package/topper.js +825 -0
package/specialnav.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
|
|
2
|
+
let { getBrands } = require('./brands')
|
|
3
|
+
|
|
4
|
+
// Handle nav for various markets and include nav options for other links
|
|
5
|
+
let getSpecialNav = function(meta, urlAdd, forceColor, navLink, navArray){
|
|
6
|
+
|
|
7
|
+
// If we aren't passing meta in, we have to call getSettings here
|
|
8
|
+
if (!meta){
|
|
9
|
+
let {getSettings} = require('./settings')
|
|
10
|
+
meta = getSettings()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// If a link object was not provided, make one
|
|
14
|
+
if (!navLink){
|
|
15
|
+
navLink = {
|
|
16
|
+
url: "#___gatsby",
|
|
17
|
+
text: "Special Report",
|
|
18
|
+
target: "_self"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// If a navArray was provided, create the subnav
|
|
23
|
+
let subnav = ""
|
|
24
|
+
let dropdownIcon = ""
|
|
25
|
+
if (navArray && navArray.length > 0){
|
|
26
|
+
subnav = `<ul id="subnav">`
|
|
27
|
+
for (let i = 0; i <navArray.length; i++){
|
|
28
|
+
subnav += `<li><a class="active" href="${navArray[i].url}" target="${navArray[i].target}"><span class="arrow-bullet">▶</span> ${navArray[i].text}</a></li>`
|
|
29
|
+
}
|
|
30
|
+
subnav += `</ul>`
|
|
31
|
+
// Add a dropdown icon
|
|
32
|
+
dropdownIcon = `<div class="dropdown-icon">▾</div>`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Extension to URL if passed in
|
|
36
|
+
if (!urlAdd){
|
|
37
|
+
urlAdd = ""
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let {attributes: {marketPrefix, invert, subscribeLink}} = getBrands(meta.PROJECT.MARKET_KEY)
|
|
41
|
+
|
|
42
|
+
// Handle various CT domains
|
|
43
|
+
if (typeof window !== "undefined"){
|
|
44
|
+
switch(window.location.origin){
|
|
45
|
+
case "https://www.ctpost.com": marketPrefix = "ct"; break;
|
|
46
|
+
case "https://www.nhregister.com": marketPrefix = "nh"; break;
|
|
47
|
+
case "https://www.greenwichtime.com": marketPrefix = "gt"; break;
|
|
48
|
+
case "https://www.stamfordadvocate.com": marketPrefix = "st"; break;
|
|
49
|
+
case "https://www.thehour.com": marketPrefix = "th"; break;
|
|
50
|
+
case "https://www.newstimes.com": marketPrefix = "nt"; break;
|
|
51
|
+
case "https://www.middletownpress.com": marketPrefix = "mp"; break;
|
|
52
|
+
case "https://www.ctinsider.com": marketPrefix = "in"; break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Default is white text on black nav (SFC style)
|
|
57
|
+
let invertClass = ""
|
|
58
|
+
let color = "white"
|
|
59
|
+
// If inverted, do black on white nav
|
|
60
|
+
// Only change things if color isn't forced to white
|
|
61
|
+
if (invert || forceColor === "white"){
|
|
62
|
+
invertClass = "invert"
|
|
63
|
+
color = "black"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let subfolder = ""
|
|
67
|
+
if (meta.PROJECT.SUBFOLDER){
|
|
68
|
+
subfolder = meta.PROJECT.SUBFOLDER + "/"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const getLinkHtml = (prefix) =>{
|
|
72
|
+
let htmlBlock = `<a class="special-nav-subscribe-link" href=${subscribeLink} target="_blank">
|
|
73
|
+
<p>Subscribe</p>
|
|
74
|
+
</a>`
|
|
75
|
+
if(prefix == "ct"){
|
|
76
|
+
htmlBlock += `<a class="special-nav-newsletter-link" href="https://link.ctpost.com/join/signup-po" target="_blank">
|
|
77
|
+
<p>Newsletters</p>
|
|
78
|
+
</a>`
|
|
79
|
+
}
|
|
80
|
+
else if(prefix == "sf"){
|
|
81
|
+
htmlBlock += `<a class="special-nav-newsletter-link" href="https://link.sfchronicle.com/join/signup" target="_blank">
|
|
82
|
+
<p>Newsletters</p>
|
|
83
|
+
</a>`
|
|
84
|
+
}
|
|
85
|
+
else if(prefix == "hc"){
|
|
86
|
+
htmlBlock += `<a class="special-nav-newsletter-link" href="https://link.houstonchronicle.com/join/signup-hc" target="_blank">
|
|
87
|
+
<p>Newsletters</p>
|
|
88
|
+
</a>`
|
|
89
|
+
}
|
|
90
|
+
return htmlBlock
|
|
91
|
+
}
|
|
92
|
+
let navRightHtml = getLinkHtml(marketPrefix)
|
|
93
|
+
let navHTML = `<nav class="topper-special-nav-container ${invertClass}">
|
|
94
|
+
<div class="special-nav-left">
|
|
95
|
+
<a class="special-nav-back"
|
|
96
|
+
href="/"
|
|
97
|
+
target="_blank"
|
|
98
|
+
rel="noopener noreferrer">
|
|
99
|
+
<svg class="special-nav-carrot" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
100
|
+
viewBox="0 0 16.9 15" style="enable-background:new 0 0 16.9 15;" xml:space="preserve">
|
|
101
|
+
<polygon points="9,14.5 2,7.5 9,0.5 10.3,1.8 4.5,7.5 10.3,13.2 "/>
|
|
102
|
+
</svg>
|
|
103
|
+
<p class="special-nav-home">
|
|
104
|
+
Home
|
|
105
|
+
<p>
|
|
106
|
+
</a>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="special-nav-center">
|
|
109
|
+
<a class = "special-nav-logo-link"
|
|
110
|
+
href="/"
|
|
111
|
+
target="_blank"
|
|
112
|
+
rel="noopener noreferrer">
|
|
113
|
+
<img
|
|
114
|
+
class="topper-special-nav-desk-logo"
|
|
115
|
+
alt="Logo"
|
|
116
|
+
src="https://files.sfchronicle.com/static-assets/logos/${marketPrefix}-white.png"
|
|
117
|
+
></img>
|
|
118
|
+
</a>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="special-nav-right">
|
|
121
|
+
${navRightHtml}
|
|
122
|
+
</div>
|
|
123
|
+
</nav>`
|
|
124
|
+
|
|
125
|
+
return navHTML
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
module.exports = { getSpecialNav }
|