Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config structure simplification #19

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 7 additions & 26 deletions config/homepage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,23 @@
"zones": [
{
"id": "zone-community-events",
"vip": "#secondary-story-9",
"type": "editorial",
"filters": [
{
"type": "config",
"name": "zone.communityEvents",
"value": true
}
],
"filters": {
"zone.communityEvents": true
},
"zephr": {
"feature": "zone-community-events",
"dataset": [
{
"type": "config",
"name": "market",
"value": "marketInfo.domain"
}
]
},
"placement": {
"type": "query",
"value": "#secondary-story-9"
"dataset": ["marketInfo.domain"]
}
},
{
"id": "zone-el-9",
"placement": {
"type": "query",
"value": "#secondary-story-6"
}
"vip": "#seconddary-story-6"
},
{
"id": "zone-el-11",
"placement": {
"type": "query",
"value": "#secondary-story-10"
}
"vip": "#secondary-story-10"
}
]
}
12 changes: 3 additions & 9 deletions config/section.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
"zones": [
{
"id": "zone-el-9",
"filters": [
{
"type": "subscriber",
"value": false
}
],
"placement": {
"type": "query",
"value": ".grid > :nth-child(14)"
"vip": ".grid > :nth-child(14)",
"filters": {
"subscriber": false
}
}
]
Expand Down
125 changes: 39 additions & 86 deletions config/story.json
Original file line number Diff line number Diff line change
@@ -1,125 +1,78 @@
{
"base": ".story-body [id^=zone-el]",
"wps": ".story-body [id^=zone-el]",
"ignore": ["zone-el-16"],
"cadence": {
"subscriber": 4,
"dma": 3,
"standard": 2
},
"zones": [
{
"id": "zone-el-1",
"vip": ".flag",
"position": "afterend",
"filters": {
"subscriber": false,
"zone.sponsoredArticle": false
}
},
{
"id": "zone-taboola-recommendations",
"filters": [
{
"type": "config",
"name": "zone.taboolaRecommendations",
"value": true
}
],
"after": "zone-el-101",
"tracking": true,
"filters": {
"zone.taboolaRecommendations": true
},
"zephr": {
"feature": "zone-taboola-recommendations",
"dataset": [
{
"type": "dma",
"name": "dma"
}
]
},
"placement": {
"type": "after",
"value": "zone-el-101"
},
"tracking": true
"dataset": ["dma"]
}
},
{
"id": "zone-si-tickets",
"cue": 278143207,
"filters": [
{
"type": "config",
"name": "zone.siTickets",
"value": true
}
],
"placement": {
"type": "after",
"value": "zone-el-101"
"after": "zone-el-101",
"filters": {
"zone.siTickets": true
}
},
{
"id": "zone-gamecocks-nav",
"vip": ".story-body",
"cue": 278142507,
"filters": [
{
"type": "config",
"name": "zone.gamecocksNav",
"value": true
}
],
"placement": {
"type": "query",
"value": ".story-body"
"filters": {
"zone.gamecocksNav": true
}
},
{
"id": "zone-sponsored-article",
"cue": 277282728,
"filters": [
{
"type": "config",
"name": "zone.sponsoredArticle",
"value": true
}
],
"placement": {
"type": "query",
"value": ".story-body > .header"
},
"classList": ["hidden"]
"vip": ".story-body > .header",
"classList": ["hidden"],
"filters": {
"zone.sponsoredArticle": true
}
},
{
"id": "zone-local-news-digest",
"tracking": true,
"filters": [
{
"type": "config",
"name": "zone.localNewsDigest",
"value": true
},
{
"type": "dma",
"value": true
}
],
"after": "zone-el-101",
"classList": ["stn-player"],
"filters": {
"dma": true,
"zone.localNewsDigest": true
},
"zephr": {
"feature": "zone-local-news-digest",
"dataset": [
{
"type": "config",
"name": "domain",
"value": "marketInfo.domain"
}
]
},
"placement": {
"type": "after",
"value": "zone-el-101"
},
"classList": ["stn-player"]
"dataset": ["marketInfo.domain"]
}
},
{
"id": "zone-lexgoeat-sponsor",
"vip": ".story-body",
"cue": 266575046,
"filters": [
{
"type": "config",
"name": "zone.lexgoEatSponsor",
"value": true
}
],
"placement": {
"type": "query",
"value": ".story-body"
"filters": {
"zone.lexgoEatSponsor": true
}
}
]
Expand Down
4 changes: 4 additions & 0 deletions demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
min-height: 300px;
}

.digest {
min-height: 600px;
}

.lead-item {
min-height: 600px;
}
Expand Down
86 changes: 86 additions & 0 deletions demo/homepage/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!doctype html>
<html lang="en" data-pagetype="homepage">
<head>
<title>Zones homepage demo</title>
<link rel="icon" type="image/x-icon" href="https://www.kansascity.com/favicon.ico">

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">

<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">

<link rel="stylesheet" href="https://storage.googleapis.com/mc-high-impact/saratoga/saratoga-1.16.15.css">
<link rel="stylesheet" href="/demo/demo.css">

<script type="module">
import locker from "../locker.js";
import distributeZones from "/index.js";

distributeZones(locker);
</script>
</head>

<body>
<!-- <div id="zone-el-1"></div> -->
<!-- <div id="zone-el-2"></div> -->
<div class="card flag"></div>

<section class="grid">
<article class="card lead-item"></article>

<div id="zone-el-5" class="zone two-rows"></div>

<div class="digest"></div>
<article id="secondary-story-2" class="card"></article>
<article id="secondary-story-3" class="card"></article>
<div class="digest"></div>

<article id="secondary-story-4" class="card"></article>
<article id="secondary-story-5" class="card"></article>
<article id="secondary-story-6" class="card"></article>
<article id="secondary-story-7" class="card"></article>
<article id="secondary-story-8" class="card"></article>
<article id="secondary-story-9" class="card"></article>

<div id="zone-el-6" class="zone"></div>

<div class="digest-group">
<div class="partner-label">
<span>Digest group</span>
</div>
<div class="digest"></div>
<div class="digest"></div>
<div class="digest"></div>
</div>

<article id="secondary-story-10" class="card"></article>
<article id="secondary-story-11" class="card"></article>

<div id="zone-el-8" class="zone three-columns"></div>

<div class="digest-group">
<div class="partner-label">
<span>Digest group</span>
</div>
<div class="digest"></div>
<div class="digest"></div>
<div class="digest"></div>
</div>

<article id="secondary-story-12" class="card"></article>
<article id="secondary-story-13" class="card"></article>
<article id="secondary-story-13" class="card"></article>
<article id="secondary-story-14" class="card"></article>
<article id="secondary-story-15" class="card"></article>
<article id="secondary-story-16" class="card"></article>

<div id="zone-el-15" class="zone"></div>

<article id="secondary-story-17" class="card"></article>
<article id="secondary-story-18" class="card"></article>
<article id="secondary-story-19" class="card"></article>
</section>
</body>
</html>
12 changes: 7 additions & 5 deletions demo/locker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ const locker = {
case "zone.communityEvents":
return true;
case "zone.taboolaRecommendations":
return true;
return false;
case "zone.siTickets":
return false;
case "zone.gamecocksNav":
return false;
case "zone.sponsoredArticle":
return true;
return false;
case "zone.lexgoEatSponsor":
return false;
case "zone.localNewsDigest":
return true;
default:
return undefined;
Expand All @@ -44,15 +46,15 @@ const locker = {
// user info
user: {
isSubscriber() {
return true;
return false;
},

isLoggedIn() {
return false;
},

isInDMA() {
return Promise.resolve(false);
return Promise.resolve(true);
}
},

Expand Down Expand Up @@ -95,7 +97,7 @@ const locker = {
// Demo only for now
config: {
homepage: "/config/homepage.json",
section: "/config/section.json",
sectfront: "/config/section.json",
story: "/config/story.json"
}
}
Expand Down
2 changes: 1 addition & 1 deletion demo/section/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">

<link rel="stylesheet" href="https://storage.googleapis.com/mc-high-impact/saratoga/saratoga-1.16.4.css">
<link rel="stylesheet" href="https://storage.googleapis.com/mc-high-impact/saratoga/saratoga-1.16.15.css">
<link rel="stylesheet" href="/demo/demo.css">

<script type="module">
Expand Down
2 changes: 2 additions & 0 deletions demo/story/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
</head>

<body>
<!-- <div id="zone-el-1"></div> -->

<div class="card flag"></div>

<article class="paper story-body">
Expand Down
Loading