mirror of
https://github.com/treffynnon/sqlstyle.guide.git
synced 2025-03-09 12:49:51 -05:00
Add some more ancillilary info
This commit is contained in:
parent
2b92604de6
commit
8a77cd5953
4 changed files with 56 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
|||
SQL style guide
|
||||
</span> by
|
||||
<a xmlns:cc="http://creativecommons.org/ns#"
|
||||
href="https://www.simonholywell.com"
|
||||
href="https://www.simonholywell.com/?utm_source=sqlstyle.guide&utm_medium=link&utm_campaign=footer-licence"
|
||||
property="cc:attributionName"
|
||||
rel="cc:attributionURL">
|
||||
Simon Holywell
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="wrap">
|
||||
<h1 itemprop="name">SQL Style Guide</h1>
|
||||
<p class="author" itemprop="author">by
|
||||
<a href="https://www.simonholywell.com" itemprop="url"><span itemprop="name">Simon Holywell</span></a> ·
|
||||
<a href="https://www.simonholywell.com/?utm_source=sqlstyle.guide&utm_medium=link&utm_campaign=header" itemprop="url"><span itemprop="name">Simon Holywell</span></a> ·
|
||||
<a href="https://twitter.com/treffynnon">@Treffynnon</a>
|
||||
</p>
|
||||
<p class="twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}" data-text="SQL style guide by @treffynnon: {{ site.description }}" data-size="large" data-dnt="true">Tweet</a>
|
||||
|
|
|
@ -1247,7 +1247,7 @@ ZEROFILL
|
|||
ZONE
|
||||
```
|
||||
|
||||
[simon]: https://www.simonholywell.com/
|
||||
[simon]: https://www.simonholywell.com/?utm_source=sqlstyle.guide&utm_medium=link&utm_campaign=md-document
|
||||
"SimonHolywell.com"
|
||||
[issue]: https://github.com/treffynnon/sqlstyle.guide/issues
|
||||
"SQL style guide issues on GitHub"
|
||||
|
|
54
scripts.js
54
scripts.js
|
@ -30,4 +30,56 @@ $(document).ready(function(){
|
|||
window.location.hash = target;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// http://exisweb.net/link-tracking-universal-analytics
|
||||
(function trackOutbounds() {
|
||||
var hitCallbackHandler = function(url,win) {
|
||||
if (win) {
|
||||
window.open(url, win);
|
||||
} else {
|
||||
window.location.href = url;
|
||||
}
|
||||
};
|
||||
|
||||
var addEvent = function(el, eventName, handler) {
|
||||
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener(eventName, handler);
|
||||
} else {
|
||||
el.attachEvent('on' + eventName, function(){
|
||||
handler.call(el);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (document.getElementsByTagName) {
|
||||
var el = document.getElementsByTagName('a');
|
||||
var getDomain = document.domain.split('.').reverse()[1] + '.' + document.domain.split('.').reverse()[0];
|
||||
|
||||
// Look thru each a element
|
||||
for (var i=0; i < el.length;i++) {
|
||||
|
||||
// Extract it's href attribute
|
||||
var href = (typeof(el[i].getAttribute('href')) == 'string' ) ? el[i].getAttribute('href') : '';
|
||||
|
||||
// Query the href for the top level domain (xxxxx.com)
|
||||
var myDomain = href.match(getDomain);
|
||||
|
||||
// If link is outbound and is not to this domain
|
||||
if ((href.match(/^(https?:|\/\/)/i) && !myDomain) || href.match(/^mailto\:/i)) {
|
||||
|
||||
// Add an event to click
|
||||
addEvent(el[i],'click', function(e) {
|
||||
var url = this.getAttribute('href'), win = (typeof(this.getAttribute('target')) == 'string') ? this.getAttribute('target') : '';
|
||||
// Log even to Analytics, once done, go to the link
|
||||
ga('send', 'event', 'outbound', 'click', url,
|
||||
{'hitCallback': hitCallbackHandler(url,win)},
|
||||
{'nonInteraction': 1}
|
||||
);
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
Loading…
Reference in a new issue