Opens a new window to reveal the data layer on any Gannett site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof gciData !== "undefined" && gciData && gciData[0]) { | |
var w, d; | |
w = window.open('about:blank','','width=900,height=700,resizeable,scrollbars'); | |
d = w.document; | |
d.writeln('<title>gciData[0] Data Layer: ', location.href, '</title>'); | |
d.writeln('<style>td {vertical-align:top; font:9pt courier; border-bottom:1px solid #ddd}</style><table>'); | |
//sort the keys and only write out the non-objects | |
Object.entries(gciData[0]).sort((a, b) => a[0].localeCompare(b[0])).forEach(([key, value]) => { | |
if (typeof value !== "object") | |
d.writeln('<tr><td>', key, '</td><td>', value, '</td></tr>') | |
}); | |
d.writeln('</table>'); | |
d.close(); | |
} else alert('No gciData present'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:void%20function(){if(%22undefined%22!=typeof%20gciData%26%26gciData%26%26gciData[0]){var%20a,b;a=window.open(%22about:blank%22,%22%22,%22width=900,height=700,resizeable,scrollbars%22),b=a.document,b.writeln(%22%3Ctitle%3EgciData[0]%20Data%20Layer:%20%22,location.href,%22%3C/title%3E%22),b.writeln(%22%3Cstyle%3Etd%20{vertical-align:top;%20font:9pt%20courier;%20border-bottom:1px%20solid%20%23ddd}%3C/style%3E%3Ctable%3E%22),Object.entries(gciData[0]).sort((c,a)=%3Ec[0].localeCompare(a[0])).forEach(([a,c])=%3E{%22object%22!=typeof%20c%26%26b.writeln(%22%3Ctr%3E%3Ctd%3E%22,a,%22%3C/td%3E%3Ctd%3E%22,c,%22%3C/td%3E%3C/tr%3E%22)}),b.writeln(%22%3C/table%3E%22),b.close()}else%20alert(%22No%20gciData%20present%22)}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment