release v0.1.0
[awesomized/ext-ion] / docs / v0.1 / index.js
1 "use strict";
2
3 $(function() {
4 var mdref = {
5 log: function log() {
6 console.log.apply(console, arguments);
7 },
8 blink: function blink(c) {
9 var $c = $(c);
10
11 $c.fadeOut("fast").queue(function(next) {
12 this.style.color = "red";
13 next();
14 }).fadeIn("fast").fadeOut("slow").queue(function(next) {
15 this.style.color = "";
16 next();
17 }).fadeIn("slow");
18 },
19 hashchange: function hashchange() {
20 if (location.hash.length > 1) {
21 var hash = decodeURIComponent(location.hash.substring(1));
22 var e;
23 if ((e = document.getElementById(location.hash.substring(1)))) {
24 mdref.blink(e);
25 } else {
26 var scrolled = false;
27
28 if (hash.substring(hash.length-1) === "*") {
29 hash = hash.substring(0, hash.length-1);
30 }
31 $((hash.substring(0,1) === "$") ? ".var" : ".constant").each(function(i, c) {
32 if (c.textContent.substring(0, hash.length) === hash) {
33 if (!scrolled) {
34 $(window).scrollTop($(c).offset().top - 100);
35 scrolled = true;
36 }
37 mdref.blink(c);
38 }
39 });
40 }
41 }
42 }
43 };
44
45 $(window).on("hashchange", mdref.hashchange);
46 mdref.hashchange();
47
48 $("#disqus_activator").on("click", function() {
49 var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
50 dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
51 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
52 });
53 $.ajax("https://disqus.com/api/3.0/threads/details.json?thread:ident="+(disqus_identifier||"index")+"&forum=mdref&api_key=VmhVG4z5jjtY8SCaMstOjfUuwniMv43Xy9FCU9YfEzhsrl95dNz1epykXSJn8jt9"). then(function(json) {
54 if (json && json.response) {
55 $("#disqus_activator span").text(json.response.posts);
56 }
57 });
58 setTimeout(function() {
59 $("footer").addClass("hidden");
60 }, 1000);
61 });