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

Feature/remove junk 2 #621

Merged
merged 39 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
784025f
Merge pull request #611 from GSA/staging
arnayv-47 Jan 30, 2025
97efeb5
Merge pull request #616 from GSA/staging
attorri Feb 4, 2025
35078ce
again
attorri Feb 5, 2025
eb73908
forceful redirect simplified
attorri Feb 5, 2025
af4f283
preventing default
attorri Feb 5, 2025
ea77a76
preventing default
attorri Feb 5, 2025
3595d52
fix
attorri Feb 5, 2025
f4860d2
d
attorri Feb 5, 2025
f609dd2
preventing default
attorri Feb 5, 2025
cec9ff1
d
attorri Feb 5, 2025
d157853
d
attorri Feb 5, 2025
c0f197e
d
attorri Feb 5, 2025
0fc96b0
d
attorri Feb 5, 2025
53bb5ab
d
attorri Feb 5, 2025
9971942
s
attorri Feb 5, 2025
301cc03
Update app.js
attorri Feb 5, 2025
3fc3f66
Update app.js
attorri Feb 5, 2025
0cb3f87
d
attorri Feb 5, 2025
ffd8153
new
attorri Feb 5, 2025
1882096
just button
attorri Feb 5, 2025
4aa1350
got rid to see what happens
attorri Feb 5, 2025
8a7862f
Update app.js
attorri Feb 5, 2025
e3f00e0
finally
attorri Feb 5, 2025
3a51e37
s
attorri Feb 5, 2025
8162158
dev function too
attorri Feb 5, 2025
f24a5c5
dev
attorri Feb 5, 2025
768585c
for dev
attorri Feb 5, 2025
e45d9e4
prod
attorri Feb 5, 2025
43527b8
prod
attorri Feb 5, 2025
499cde1
prod
attorri Feb 5, 2025
4cd9dae
prod
attorri Feb 5, 2025
a6ba8fa
prod
attorri Feb 5, 2025
95ca029
prod ish
attorri Feb 5, 2025
84d4458
Update app.js
attorri Feb 5, 2025
da2fbfc
done
attorri Feb 5, 2025
77a7561
prod
attorri Feb 5, 2025
bde2437
cleansed
attorri Feb 5, 2025
2b652bd
got rid of logs
attorri Feb 5, 2025
23dadc9
again
attorri Feb 5, 2025
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
38 changes: 38 additions & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
// Add your custom javascript here
console.log("Hi from Federalist");

function redirectLinks() {
console.log('Running redirectLinks...');

let anchors = document.querySelectorAll('a[href*="/preview/gsa/eoc/"]');

anchors.forEach(anchor => {
let href = anchor.getAttribute('href');

console.log(`Processing href: ${href}`);

if (href.includes('evidenceportal')) {
let ind = href.indexOf('evidenceportal');

if (ind !== -1) {
let newHref = href.substring(ind);
if (window.origin.includes('evaluation.gov')) {
let updatedHref = `${window.origin}/${newHref}`;
anchor.setAttribute('href', updatedHref);
}
else {
let updatedHref = `https://evaluation.gov/${newHref}`;
anchor.setAttribute('href', updatedHref);
}
}
}
});
}

document.addEventListener("DOMContentLoaded", redirectLinks);

const observer = new MutationObserver(() => {
redirectLinks();
});

observer.observe(document.body, { childList: true, subtree: true });



// Add a new class for all of the external anchor tags
$("a").each(function(index, element) {
if (!$(element).attr("href").startsWith('https://www.evaluation.gov' && 'javascript:void(0)')
Expand Down
19 changes: 16 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ function shorten(s, max){
if (s.length) cut = cut.substring(0,cut.length-1) + '...'
return cut
}
let s = "Readability: the readability of the title is so-so. Having a dash (-) and pipe (|)in the title tag decreases readability. On top of that, the title is truncated which hurts the readability as well. Relevant keywords: the title tag is not very relevant - what does “Canada’s Top Business Law Firm” have to do with your search query? Besides, the keyword usage in the title tag is not good - the applicable keywords are at the end"
s = shorten(s,60)
console.log(s);
//let s = "Readability: the readability of the title is so-so. Having a dash (-) and pipe (|)in the title tag decreases readability. On top of that, the title is truncated which hurts the readability as well. Relevant keywords: the title tag is not very relevant - what does “Canada’s Top Business Law Firm” have to do with your search query? Besides, the keyword usage in the title tag is not good - the applicable keywords are at the end"
// s = shorten(s,60)
// console.log(s);

let origin = 'https://federalist-a1f29504-db06-4d32-992e-c2dadbfe82f2.sites.pages.cloud.gov';

let fullUrl = 'https://federalist-a1f29504-db06-4d32-992e-c2dadbfe82f2.sites.pages.cloud.gov/preview/gsa/eoc/feature/OMB-3-Release2.0-Demo/evidenceportal/ongoing/';

let extension = '/preview/gsa/eoc/feature/junk/evidenceportal/about/';

let e1 = extension.substring(0,extension.indexOf('evidenceportal'));
let e2 = extension.substring(extension.indexOf('evidenceportal'),extension.length);
extension = e1+e2;
console.log(extension);

let index = fullUrl.indexOf(origin) + origin.length;