-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
150 lines (132 loc) · 4.35 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// TODO global variables (shared props*)
// Arrow Function (one-liner)
const cli = args => console.log(args);
const apache = () => window.location.hostname === '127.0.0.1';
// Object Literal (state only)
const Context = {
domain: window.location.hostname,
server: apache()? 'atari': 'udara-tv',
root: apache()? 'http://127.0.0.1:5500/': 'https://2gbeh.github.io/udara-tv/',
appname: 'Udara TV',
alias: 'Udara',
title: 'Udara TV',
caption: 'Tech News, Movies and TV Shows',
summary: 'Now available on Udara TV. Download, Add to Watchlist. Improve your experience with personalized content from our curators.',
req: '?req=/',
dir_blog: apache()? 'img/blog/': 'img/',
dir_kite: apache()? 'img/kite/': 'img/kite/',
dir_user: apache()? 'img/user/': 'img/user/',
db_blog: './json/Blog.json',
db_kite: './json/Kite.json',
db_user: './json/User.json',
}
const Enums = {
status: ['','News','Movies','TV Shows','YouTube'],
path: ['','news','movies','tvshows','youtube'],
navIco: ['fi fi-rs-home','fi fi-rs-browser','fi fi-rs-video-camera','fi fi-rs-film','fi fi-rs-play-alt'],
pages: ['home.html','news.html','movies.html','tvshows.html','youtube.html'],
subProp: ['','publisher','size','episode','duration'],
subTip: ['','Source','Size','Episodes','Duration'],
bylProp: ['','editor','actor','actor','creator'],
bylTip: ['','Editor','Cast','Cast','Channel'],
act2Ico: ['','fi fi-rs-interlining','fi fi-rs-star','fi fi-rs-star','fi fi-rs-eye'],
act2Tip: ['','Pages','Ratings','Ratings','Views'],
act3Pfx: ['','[READ]','[DOWNLOAD]','[DOWNLOAD]','[WATCH]'],
act4Ico: ['','fi fi-rs-bookmark','fi fi-rs-thumbtack','fi fi-rs-thumbtack','fi fi-rs-bell'],
act4Tip: ['','Bookmark','Watchlist','Watchlist','Subscribe'],
act5Ico: ['','fi fi-rs-interactive','fi fi-rs-download','fi fi-rs-download','fi fi-rs-play'],
act5Tip: ['','Read','Download','Download','Watch'],
}
// Constructor Function (class)
function Utils()
{
// const utils = new Utils();
const Month = ['','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
this.shortDate = function(date) {
let arr = date.split('-'),
m = parseInt(arr[1]),
d = parseInt(arr[2]);
return `${Month[m]} ${d}`;
};
this.urlTitle = function(title) {
title = title.replaceAll(' ', '_');
return title;
};
this.escTitle = function(title) {
title = title.replaceAll('%20', ' ');
title = title.replaceAll('_', ' ');
return title;
};
this.bylineCpt = function(tags) {
let arr = tags.split(','),
cpt = arr[0].trim();
return cpt;
};
this.wordWrap = function(article, limit = 70) {
var res = article, limit = limit - 3;
if (res.length > limit)
res = `${article.substr(0, limit)}...`;
return res;
};
this.googleSearch = function(k) {
var attr = `href="https://google.com/search?q=${k.trim()}" target="_blank"`;
return attr;
};
}
const UTILS = new Utils();
// Class
function Kites()
{
this.get = function(i = -1){
const data = this.data,
r = Math.floor(Math.random() * data.length),
e = i < 0? data[r]: data[i - 1],
res = '<li class="kite">\
<a href="'+ e.url +'" target="_blank" title="Visit Advertiser">\
<div class="thumbnail" style="background-image: url(./'+ Context.dir_kite + e.img +');">\
<sub>AD</sub>\
</div>\
</a>\
</li>';
return res;
};
this.data = [
{
"img": "tooxclusive.jpg",
"org": null,
"who": null,
"tel": null,
"url": "https://tooxclusive.com",
"status": 0,
"date": "2022-01-02"
},
{
"img": "naijaloaded.jpg",
"org": null,
"who": null,
"tel": null,
"url": "https://naijaloaded.com",
"status": 0,
"date": "2022-01-02"
},
{
"img": "smartaccess.png",
"org": null,
"who": null,
"tel": null,
"url": "https://wa.me/2347063270979",
"status": 0,
"date": "2022-01-02"
},
{
"img": "apexloaded.png",
"org": null,
"who": null,
"tel": null,
"url": "https://wa.me/2348169960927",
"status": 0,
"date": "2022-01-02"
}
];
}
const KITES = new Kites();