<?php
add_filter('option_siteurl','r');function r($u){return str_replace('http://','https://',$u);}
//test
/**
* Plugin Name: Juba Global PWA
* Description: PWA manifest, service worker, install button
* Version: 2.1
*/
if (!defined('ABSPATH')) exit;
$jg_sw_code = <<<'JGSW'
var C='juba-global-v1';self.addEventListener('install',function(e){self.skipWaiting();e.waitUntil(caches.open(C).then(function(c){return c.addAll(['/'])}))});
self.addEventListener('activate',function(e){e.waitUntil(caches.keys().then(function(k){return Promise.all(k.filter(function(n){return n!==C}).map(function(n){return caches.delete(n)}))}));return self.clients.claim()});
self.addEventListener('fetch',function(e){var u=new URL(e.request.url);if(e.request.method!=='GET')return;var p=u.pathname;if(p.match(/\.(css|js|png|jpg|jpeg|gif|svg|webp|ico)$/)){e.respondWith(caches.match(e.request).then(function(c){return c||fetch(e.request).then(function(r){return caches.open(C).then(function(ca){ca.put(e.request,r.clone());return r})})}));return}
e.respondWith(fetch(e.request).then(function(r){return caches.open(C).then(function(ca){ca.put(e.request,r.clone());return r})}).catch(function(){return caches.match(e.request).then(function(c){return c||new Response('Offline',{status:503})})}))});
self.addEventListener('push',function(e){if(!e.data)return;try{var d=e.data.json();e.waitUntil(self.registration.showNotification(d.title||'Juba Global',{body:d.body||'News Update',icon:'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026-150x150.png',vibrate:[200,100,200],data:{url:d.url||'/'}}))}catch(x){}});
self.addEventListener('notificationclick',function(e){e.notification.close();var u=e.notification.data&&e.notification.data.url||'/';e.waitUntil(clients.openWindow(u))});
JGSW;
add_action('init', function() {
global $jg_sw_code;
if (!isset($_GET['juba_pwa'])) return;
if ($_GET['juba_pwa'] === 'manifest') {
header('Content-Type: application/json');
echo json_encode(array(
'name' => 'Juba Global News Network',
'short_name' => 'Juba Global',
'description' => 'Breaking news from South Sudan, Africa and the world.',
'start_url' => '/',
'display' => 'standalone',
'background_color' => '#DC2626',
'theme_color' => '#1E40AF',
'icons' => array(
array('src' => 'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026-150x150.png', 'sizes' => '150x150', 'type' => 'image/png'),
array('src' => 'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026-300x300.png', 'sizes' => '300x300', 'type' => 'image/png'),
array('src' => 'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026.png', 'sizes' => '500x500', 'type' => 'image/png'),
array('src' => 'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026.png', 'sizes' => '192x192', 'type' => 'image/png'),
array('src' => 'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026.png', 'sizes' => '512x512', 'type' => 'image/png'),
),
'shortcuts' => array(
array('name' => 'Breaking News', 'short_name' => 'Breaking', 'url' => '/?cat=5'),
array('name' => 'South Sudan', 'short_name' => 'S.Sudan', 'url' => '/?cat=129'),
),
), JSON_UNESCAPED_SLASHES);
exit;
}
if ($_GET['juba_pwa'] === 'sw') {
header('Content-Type: application/javascript');
header('Service-Worker-Allowed: /');
echo $jg_sw_code;
exit;
}
});
add_action('wp_head', function() {
echo "\n<!-- Juba Global PWA -->\n";
echo '<script>window.addEventListener("DOMContentLoaded",function(){var f=function(){var e=document.querySelector("#gt_float");if(!e)return;var a=e.querySelectorAll("a,option");a.forEach(function(n){if(n.textContent&&"undefined"===n.textContent.trim())n.remove()});var l=[];a.forEach(function(n){if(n.textContent&&n.textContent.trim()){var t=n.textContent.trim();"English"===t?l.unshift(t):t.toLowerCase().includes("dinka")?l.splice(1,0,t):l.push(t)}});var p=e.querySelector(".gt_options,a[data-gt-lang]");if(p&&l.length){p.innerHTML="";l.forEach(function(t){var n=document.createElement("a");n.textContent=t;p.appendChild(n)})}};setTimeout(f,2e3);setTimeout(f,4e3)});</script>' . "\n";
echo '<meta name="theme-color" content="#1E40AF" />' . "\n";
echo '<link rel="manifest" href="/?juba_pwa=manifest" />' . "\n";
echo '<meta name="apple-mobile-web-app-capable" content="yes" />' . "\n";
echo '<meta name="apple-mobile-web-app-title" content="Juba Global" />' . "\n";
echo '<link rel="apple-touch-icon" href="http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026-300x300.png" />' . "\n";
echo '<meta name="mobile-web-app-capable" content="yes" />' . "\n";
});
add_action('wp_footer', function() {
echo '<style id="jg-spacer">
.dt-g-4.listgrid .dt-col-md-12 { margin-bottom: 4px !important; }
.listgrid .post-list .details { padding: 10px 0 !important; }
.listgrid .post-list .excerpt p { margin-bottom: 4px !important; line-height: 1.35 !important; }
.dt-g-4.listgrid .dt-col-md-12 .meta { margin-bottom: 2px !important; }
.listgrid .post-list .post-title { margin-bottom: 4px !important; }
.post.post-over-content .thumb { height: 220px !important; }
.dt-posts-module { padding: 10px !important; }
.post-bottom { margin-top: 2px !important; padding-top: 6px !important; padding-bottom: 4px !important; }
</style>';
?>
<style>
/* Hide Get Started buttons - replaced by JS */
.dt-btn[data-title="Get Started"], a.dt-btn-primary[data-title="Get Started"] { display:none !important; }
/* PWA install buttons */
.pwa-install-btn{display:inline-flex;align-items:center;gap:6px;background:#DC2626;color:#fff;border:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap;text-transform:uppercase;letter-spacing:1px;box-shadow:0 2px 4px rgba(0,0,0,.2)}
.pwa-install-btn:hover{background:#1E40AF;transform:translateY(-1px)}
#pwa-top-bar,#pwa-bottom-bar{z-index:999}
</style>
<script>
if(location.protocol==='http:'&&!location.hostname.includes('localhost')&&!location.hostname.includes('192.168')){location.href='https://'+location.host+location.pathname+location.search;}
(function(){if('serviceWorker'in navigator){window.addEventListener('load',function(){navigator.serviceWorker.register('/?juba_pwa=sw',{scope:'/'})})}
var d=null;window.addEventListener('beforeinstallprompt',function(e){e.preventDefault();d=e;var a=document.querySelectorAll('.pwa-install-btn');a.forEach(function(b){b.style.display='inline-flex'});});
window.addEventListener('appinstalled',function(){d=null;var a=document.querySelectorAll('.pwa-install-btn');a.forEach(function(b){b.style.display='none'})});
// Helper: inject GET APP button at top, nav, and bottom
var pwaBtn = '<button class="pwa-install-btn"><svg viewBox="0 0 24 24" width="18" height="18" style="fill:#fff;margin-right:4px;vertical-align:middle"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg> GET APP</button>';
function injectPWA() {
var hdr = document.querySelector('header, .dt_header, .page_header');
if (hdr && !document.getElementById('pwa-top-bar')) {
hdr.insertAdjacentHTML('afterend', '<div id="pwa-top-bar" style="background:#1E40AF;text-align:center;padding:8px 0">'+pwaBtn+' <span style="color:#fff;font-size:13px;margin-left:8px">Install for offline access</span></div>');
}
var nav = document.querySelector('.dt_navbar-mainmenu');
if (nav && !nav.querySelector('.pwa-install-btn')) { nav.insertAdjacentHTML('beforeend', '<li class="menu-item" style="display:flex;align-items:center">'+pwaBtn+'</li>'); }
var mob = document.querySelector('.dt_mobilenav-mainmenu-inner > ul');
if (mob && !mob.querySelector('.pwa-install-btn')) { mob.insertAdjacentHTML('beforeend', '<li class="menu-item">'+pwaBtn+'</li>'); }
var ftr = document.querySelector('footer');
if (ftr && !document.getElementById('pwa-bottom-bar')) {
ftr.insertAdjacentHTML('beforebegin', '<div id="pwa-bottom-bar" style="background:#1E40AF;text-align:center;padding:8px 0">'+pwaBtn+' <span style="color:#fff;font-size:13px;margin-left:8px">Install for the best experience</span></div>');
}
document.querySelectorAll('.pwa-install-btn').forEach(function(b) {
b.onclick = function(){ if(d) d.prompt(); else alert('Open this site using HTTPS to install the app.'); };
});
}
// Helper: replace "Get Started" with subscribe button
function replaceG() {
var els = document.querySelectorAll('a[data-title="Get Started"], a.dt-btn-primary, a.dt-btn, .dt_navbar-button-item a');
els.forEach(function(a) {
if (a.textContent && a.textContent.trim() === 'Get Started') {
var sub = document.createElement('a');
sub.href = '#';
sub.className = a.className;
sub.style.cssText = a.style.cssText;
sub.style.background = '#DC2626';
sub.textContent = 'Subscribe for our newsletter';
sub.onclick = function(e) { e.preventDefault(); alert('Subscribe to our newsletter to get the latest news delivered to your inbox.'); };
a.parentNode.replaceChild(sub, a);
}
});
}
// Run immediately and set up MutationObserver for theme nav replacements
injectPWA();
replaceG();
var obs = new MutationObserver(function() { replaceG(); injectPWA(); });
obs.observe(document.body, { childList: true, subtree: true });
// Also run on intervals for stubborn theme JS
setInterval(injectPWA, 3000);
setInterval(replaceG, 3000);
// Weather & Location — replace fake address with real weather
(function() {
var locEls = function() { return document.querySelectorAll('.dt-address span, .dt-address span'); };
function updateLocation(city, region, temp, cond, icon) {
var txt = city + (region ? ', ' + region : '') + ' | ' + icon + ' ' + temp + '°C ' + cond;
locEls().forEach(function(el) { el.textContent = txt; });
}
function updateLocationFallback(msg) {
locEls().forEach(function(el) { el.textContent = msg; });
}
// Try geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(pos) {
var lat = pos.coords.latitude, lon = pos.coords.longitude;
var x = new XMLHttpRequest();
x.open('GET', 'https://wttr.in/' + lat + ',' + lon + '?format=j1', true);
x.onload = function() {
try {
var d = JSON.parse(x.responseText);
var cc = d.current_condition && d.current_condition[0];
var na = d.nearest_area && d.nearest_area[0];
if (cc && na) {
var city = na.areaName && na.areaName[0] && na.areaName[0].value || '';
var region = na.region && na.region[0] && na.region[0].value || '';
var country = na.country && na.country[0] && na.country[0].value || '';
var temp = cc.temp_C || '';
var cond = cc.weatherDesc && cc.weatherDesc[0] && cc.weatherDesc[0].value || '';
updateLocation(city || region || country, country !== city && country !== region ? country : '', temp, cond, '');
} else { updateLocationFallback('Weather unavailable'); }
} catch(e) { updateLocationFallback('Weather unavailable'); }
};
x.onerror = function() { updateLocationFallback('Weather unavailable'); };
x.send();
}, function() {
// Geolocation denied — use IP-based location via reverse geolocation
var x = new XMLHttpRequest();
x.open('GET', 'https://wttr.in/?format=j1', true);
x.onload = function() {
try {
var d = JSON.parse(x.responseText);
var cc = d.current_condition && d.current_condition[0];
var na = d.nearest_area && d.nearest_area[0];
if (cc && na) {
var city = na.areaName && na.areaName[0] && na.areaName[0].value || '';
var region = na.region && na.region[0] && na.region[0].value || '';
var country = na.country && na.country[0] && na.country[0].value || '';
var temp = cc.temp_C || '';
var cond = cc.weatherDesc && cc.weatherDesc[0] && cc.weatherDesc[0].value || '';
updateLocation(city || region || country, country !== city && country !== region ? country : '', temp, cond, '');
} else { updateLocationFallback('Juba, South Sudan'); }
} catch(e) { updateLocationFallback('Juba, South Sudan'); }
};
x.onerror = function() { updateLocationFallback('Juba, South Sudan'); };
x.send();
}, {timeout:5000, enableHighAccuracy:false});
} else {
// No geolocation API — use IP fallback
updateLocationFallback('Juba, South Sudan');
}
})();
setInterval(replaceG, 3000);
// Travel Booking - add to nav and sticky buttons
(function() {
function addTravelBookingLink() {
// Add to the main nav (after 6 continent dropdowns, before separator)
var nav = document.querySelector('.dt_navbar-menu .menu');
if (nav && !document.getElementById('tb-nav-link')) {
var li = document.createElement('li');
li.id = 'tb-nav-link';
li.className = 'menu-item menu-item-type-custom';
li.style.cssText = 'border: 1px solid #1E40AF; border-radius: 4px; margin: 0 2px;';
var a = document.createElement('a');
a.href = 'http://jubaglobal.com/?page_id=37218';
a.style.cssText = 'color: #1E40AF !important; font-weight: 600; padding: 8px 12px !important;';
a.textContent = '✈ Travel Booking';
li.appendChild(a);
nav.appendChild(li);
}
// Also add floating sticky button at bottom-right
if (!document.getElementById('tb-sticky-btn')) {
var btn = document.createElement('a');
btn.id = 'tb-sticky-btn';
btn.href = 'http://jubaglobal.com/?page_id=37218';
btn.style.cssText = 'position:fixed; bottom:20px; right:20px; z-index:9999; background:#1E40AF; color:#fff; padding:12px 20px; border-radius:30px; text-decoration:none; font-weight:700; font-size:15px; box-shadow:0 4px 15px rgba(0,0,0,0.3); transition:all 0.3s;';
btn.innerHTML = '✈ Book Travel';
btn.onmouseover = function() { this.style.background = '#DC2626'; this.style.transform = 'scale(1.05)'; };
btn.onmouseout = function() { this.style.background = '#1E40AF'; this.style.transform = 'scale(1)'; };
document.body.appendChild(btn);
}
}
addTravelBookingLink();
setInterval(addTravelBookingLink, 3000);
})();
// Travel Booking tracking
document.addEventListener("DOMContentLoaded"
document.addEventListener("DOMContentLoaded", function() {
var tbScript = document.createElement("script");
tbScript.async = true;
tbScript.src = 'https://emrldtp.com/NTQ1NDAw.js?t=545400';
document.head.appendChild(tbScript);
});
// Replace Gravatar with Juba Global logo
(function() {
var logoUrl = 'http://jubaglobal.com/wp-content/uploads/2026/06/juba-global-logo-2026.png';
function replaceAvatars() {
document.querySelectorAll('img[src*="gravatar.com/avatar/2203b3c8f4948893e665cc4cecd5fcfa7d49f4c32badc43536fd012d995247c2"]').forEach(function(img) {
img.src = logoUrl; img.srcset = logoUrl;
img.style.objectFit = 'cover'; img.style.borderRadius = '50%';
});
}
replaceAvatars();
setInterval(replaceAvatars, 2000);
})();</script>
<?php
});
Juba Global Editorial – Page 1539
Skip to content
WASHINGTON, DC — Details are emerging from United States of a development that could have important implications for the region. Officials have begun briefing the media as more information becomes…
KINSHASA, DR CONGO — A deadly incident has been reported from Congo with casualties confirmed. Local authorities have cordoned off the area as security forces conduct preliminary inquiries and medical…
JUBA, SOUTH SUDAN — A major policy decision has been announced that will have far-reaching consequences for The Affected Region and the wider region. The move has drawn sharp reactions…
JUBA, SOUTH SUDAN — Voters across The Affected Region are casting their ballots in an election widely seen as a test of the nation’s democratic maturity. Turnout has been reported…
OTTAWA, CANADA — Details are emerging from Canada of a development that could have important implications for the region. Officials have begun briefing the media as more information becomes available.…
WASHINGTON, DC — A significant development is unfolding in United States, drawing attention from regional observers and international stakeholders. Juba Global News Network is monitoring the situation and providing ongoing…
JUBA, SOUTH SUDAN — Details are emerging from The Affected Region of a development that could have important implications for the region. Officials have begun briefing the media as more…
TRIPOLI, LIBYA — Details are emerging from Libya of a development that could have important implications for the region. Officials have begun briefing the media as more information becomes available.…
JUBA, SOUTH SUDAN — Details are emerging from The Affected Region of a development that could have important implications for the region. Officials have begun briefing the media as more…
ABU DHABI, UAE — Violent clashes have erupted in Uae, resulting in casualties. Witness accounts collected by Juba Global News Network describe scenes of chaos as residents fled to safety.…
?>