sfc-utils 1.4.140 → 1.4.142

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/accountswap.js CHANGED
@@ -11,6 +11,18 @@ const pollForAccount = async function (i, isNav) {
11
11
  if (!i) {
12
12
  i = 0;
13
13
  }
14
+ // Add a click event to signin
15
+ if (isNav) {
16
+ const signinButton = document.querySelector(".hnp-signin");
17
+ if (signinButton) {
18
+ // Add event listener to signin button
19
+ signinButton.onclick = function (e) {
20
+ treg.realm.core.login();
21
+ e.preventDefault();
22
+ e.stopPropagation();
23
+ };
24
+ }
25
+ }
14
26
  // Safecheck for treg since it might not be global yet
15
27
  if (window && window.treg && window.treg.identity) {
16
28
  // Now we have all the vars to know if we're logged in
@@ -20,18 +32,19 @@ const pollForAccount = async function (i, isNav) {
20
32
  }
21
33
  if (isNav) {
22
34
  // We got a valid entitlement! Let's see if the button exists and swap our new one in
23
- const subButton = document.querySelector("#nav2-sub-box");
24
- const subButtonText = document.querySelector("#nav2-sub-box div");
25
- if (subButton && subButtonText) {
26
- if (!subButtonText.innerText) {
35
+ const rightBlock = document.querySelector(".nav2-right");
36
+ if (rightBlock) {
37
+ if (!rightBlock.innerText) {
27
38
  // If there's no innerText, keep waiting
28
39
  await new Promise((resolve) => setTimeout(resolve, 1000));
29
40
  return await pollForAccount(i + 1, isNav);
30
41
  }
31
42
  // Change the inner HTML
32
- subButton.innerHTML = `<div id="#nav2-sub-box" href="${accountURL}">Account</div>`;
43
+ rightBlock.innerHTML = `<div id="#nav2-sub-box" href="${accountURL}">Account</div>`;
33
44
  // Instead of having a true link, set click event to run treg.realm.iframeProfile.NavigateToIndex()
34
45
  if (window.treg.realm.iframeProfile) {
46
+ // Find the newly swapped button
47
+ const subButton = document.querySelector("#nav2-sub-box");
35
48
  subButton.onclick = function (e) {
36
49
  window.treg.realm.iframeProfile.NavigateToIndex();
37
50
  e.preventDefault();
package/brands3.js CHANGED
@@ -48,8 +48,6 @@ let getBrands3 = function (market) {
48
48
  //subscribeLink: "https://www.sfchronicle.com/subproject",
49
49
  subscribeLink:
50
50
  "https://subscription.sfchronicle.com/checkout/684/1444?origin=button&ipid=project&variant=devhub",
51
- signinLink:
52
- "https://realm.hearstnp.com/aGRuLnNhbmZyYW5jaXNjbw==/c2ZjaHJvbmljbGUuY29t/1079/account/login",
53
51
  sailCustomer: "fca2a0390286f0e53120a668534d9529",
54
52
  sailSiteName: "san-francisco-chronicle",
55
53
  siteId: 35,
@@ -69,8 +67,6 @@ let getBrands3 = function (market) {
69
67
  invert: true,
70
68
  gaAccount: "UA-1616916-24",
71
69
  subscribeLink: "https://www.houstonchronicle.com/subproject",
72
- signinLink:
73
- "https://realm.hearstnp.com/aGRuLmhvdXN0b24=/aG91c3RvbmNocm9uaWNsZS5jb20=/1078/account/login",
74
70
  sailCustomer: "48e30b5083cf6bf47c519651453c9e8a",
75
71
  sailSiteName: "houston-chronicle",
76
72
  siteId: 33,
@@ -90,8 +86,6 @@ let getBrands3 = function (market) {
90
86
  invert: true,
91
87
  gaAccount: "UA-1616916-7",
92
88
  subscribeLink: "https://www.timesunion.com/subproject",
93
- signinLink:
94
- "https://realm.hearstnp.com/aGRuLmFsYmFueQ==/dGltZXN1bmlvbi5jb20=/1077/account/login",
95
89
  sailCustomer: "5bb9eee089bdc2e27cbd265535ad1f90",
96
90
  sailSiteName: "times-union",
97
91
  siteId: 3,
@@ -111,8 +105,6 @@ let getBrands3 = function (market) {
111
105
  invert: true,
112
106
  gaAccount: "UA-1616916-27",
113
107
  subscribeLink: "https://www.expressnews.com/subproject",
114
- signinLink:
115
- "https://realm.hearstnp.com/aGRuLnNhbmFudG9uaW8=/ZXhwcmVzc25ld3MuY29t/1080/account/login",
116
108
  sailCustomer: "aec52c4681ed63b5beab139a2584f0d4",
117
109
  sailSiteName: "san-antonio-express-news",
118
110
  siteId: 36,
@@ -132,8 +124,6 @@ let getBrands3 = function (market) {
132
124
  invert: true,
133
125
  gaAccount: "UA-1616916-99",
134
126
  subscribeLink: "https://www.ctinsider.com/subproject",
135
- signinLink:
136
- "https://realm.hearstnp.com/aGRuLmN0cHJlbWl1bQ==/Y3RpbnNpZGVyLmNvbQ==/1083/account/login",
137
127
  sailCustomer: "9b21160afa226c9f84d27b47c3d52364",
138
128
  sailSiteName: "ct-insider",
139
129
  siteId: 61,
package/nav2.js CHANGED
@@ -27,7 +27,7 @@ let getNav2 = function (meta, urlAdd, forceColor, navLink, navArray) {
27
27
  }
28
28
 
29
29
  let {
30
- attributes: { marketPrefix, invert, subscribeLink, signinLink },
30
+ attributes: { marketPrefix, invert, subscribeLink },
31
31
  } = getBrands3(meta.PROJECT.MARKET_KEY);
32
32
  // Handle various CT domains
33
33
  if (typeof window !== "undefined") {
@@ -140,20 +140,18 @@ let getNav2 = function (meta, urlAdd, forceColor, navLink, navArray) {
140
140
 
141
141
  // Using style tags just to make this easy
142
142
  let rightBlock = `
143
- <a id="nav2-sub-box" style="font-weight: 700;" href="${subscribeLink}" target="_blank">
143
+ <a id="nav2-sub-box" class="hnp-subscribe" style="font-weight: 700;" href="${subscribeLink}" target="_blank">
144
144
  <div>Subscribe</div>
145
145
  </a>
146
146
  `;
147
147
 
148
- // If there's a signin link, add it here
149
- if (signinLink) {
150
- rightBlock =
151
- `
152
- <a id="nav2-sub-box" style="margin: 0; font-weight: 700;" href="${signinLink}" target="_blank">
153
- <span>Sign in</span>
154
- </a>
155
- <span style="font-size: 14px; padding: 2px 0 2px;">or</span>` + rightBlock;
156
- }
148
+ // Add sign-in here (we can comment this out if we want to remove this)
149
+ rightBlock =
150
+ `
151
+ <a id="nav2-sub-box" class="hnp-signin" style="margin: 0; font-weight: 700;" href="/realm">
152
+ <span>Sign in</span>
153
+ </a>
154
+ <span style="font-size: 14px; padding: 2px 0 2px;">or</span>` + rightBlock;
157
155
 
158
156
  let navHTML = `<nav class="nav2-container ${invertClass}">
159
157
  <div class="nav2-left">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.140",
3
+ "version": "1.4.142",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",