Skip to content

Commit

Permalink
Merge pull request #3 from ph4ni/main
Browse files Browse the repository at this point in the history
Update page title based on current source
  • Loading branch information
ramSeraph authored Oct 9, 2024
2 parents df0cefc + e268797 commit 0d2b3aa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions static/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ const baseUrl = currUrl.replace(/\/view.*$/, '');
const tileJsonUrl = baseUrl + '/tiles.json';
const srcName = 'source-to-view';

// Set page title to something meaningful based on currUrl
let path = currUrl.split('indianopenmaps.fly.dev/')[1].split('/view')[0];
let pathParts = path.split('/');

if (pathParts[0] === 'not-so-open') {
pathParts.shift(); // Remove "not-so-open"
}

if (pathParts.length === 2) {
document.title = `${pathParts[1]} - ${pathParts[0]}`; //like bhuvan - villages
} else if (pathParts.length === 1) {
document.title = pathParts[0];
} else {
document.title = "Inspect"; //Fail case
}

let protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles", protocol.tile);
var boundary_pmtiles_url = 'https://raw.githubusercontent.com/ramSeraph/indianopenmaps/main/india_boundary_correcter/osm_corrections.pmtiles';
Expand Down

0 comments on commit 0d2b3aa

Please sign in to comment.