├── .gitignore
├── CNAME
├── LICENSE
├── README.md
├── _config.yml
├── _data
├── dinosaurs.yml
└── philosophers.yml
├── _includes
├── examples
│ ├── hashTabber-example-code-html.liquid
│ ├── hashTabber-example-code-js-options.liquid
│ ├── hashTabber-example-code-js-run.liquid
│ ├── hashTabber-example-naked.liquid
│ ├── hashTabber-example-sandstone.liquid
│ └── hashTabber-example-theme-blank.liquid
├── html-begin.liquid
├── html-end.liquid
├── img
│ └── hashtabber-logo.svg
├── page-footer.liquid
└── page-header.liquid
├── _layouts
└── default.liquid
├── assets
├── config.rb
├── css
│ └── main.css
├── img
│ └── favicon.ico
├── js
│ ├── libraries
│ │ └── hashTabber.js
│ └── script.js
└── scss
│ ├── _config.scss
│ ├── base
│ ├── _normalize.scss
│ ├── _print.scss
│ └── _typography.scss
│ ├── helpers
│ ├── _columns.scss
│ ├── _functions.scss
│ └── _mixins.scss
│ ├── layout
│ ├── _content.scss
│ ├── _footer.scss
│ └── _header.scss
│ ├── libraries
│ └── _hashTabber.scss
│ ├── main.scss
│ ├── modules
│ ├── _buttons.scss
│ └── _page-navigation.scss
│ └── themes
│ └── _hashTabber-sandstone.scss
├── humans.txt
├── index.html
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Jekyll site output
2 | _site
3 |
4 | ## ignore compass cache
5 | .sass-cache
6 |
7 | ## please do
8 | .wild-trilobites
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | hashtabber.magicznyleszek.xyz
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | CC0 1.0 Universal
2 |
3 | Statement of Purpose
4 |
5 | The laws of most jurisdictions throughout the world automatically confer
6 | exclusive Copyright and Related Rights (defined below) upon the creator and
7 | subsequent owner(s) (each and all, an "owner") of an original work of
8 | authorship and/or a database (each, a "Work").
9 |
10 | Certain owners wish to permanently relinquish those rights to a Work for the
11 | purpose of contributing to a commons of creative, cultural and scientific
12 | works ("Commons") that the public can reliably and without fear of later
13 | claims of infringement build upon, modify, incorporate in other works, reuse
14 | and redistribute as freely as possible in any form whatsoever and for any
15 | purposes, including without limitation commercial purposes. These owners may
16 | contribute to the Commons to promote the ideal of a free culture and the
17 | further production of creative, cultural and scientific works, or to gain
18 | reputation or greater distribution for their Work in part through the use and
19 | efforts of others.
20 |
21 | For these and/or other purposes and motivations, and without any expectation
22 | of additional consideration or compensation, the person associating CC0 with a
23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25 | and publicly distribute the Work under its terms, with knowledge of his or her
26 | Copyright and Related Rights in the Work and the meaning and intended legal
27 | effect of CC0 on those rights.
28 |
29 | 1. Copyright and Related Rights. A Work made available under CC0 may be
30 | protected by copyright and related or neighboring rights ("Copyright and
31 | Related Rights"). Copyright and Related Rights include, but are not limited
32 | to, the following:
33 |
34 | i. the right to reproduce, adapt, distribute, perform, display, communicate,
35 | and translate a Work;
36 |
37 | ii. moral rights retained by the original author(s) and/or performer(s);
38 |
39 | iii. publicity and privacy rights pertaining to a person's image or likeness
40 | depicted in a Work;
41 |
42 | iv. rights protecting against unfair competition in regards to a Work,
43 | subject to the limitations in paragraph 4(a), below;
44 |
45 | v. rights protecting the extraction, dissemination, use and reuse of data in
46 | a Work;
47 |
48 | vi. database rights (such as those arising under Directive 96/9/EC of the
49 | European Parliament and of the Council of 11 March 1996 on the legal
50 | protection of databases, and under any national implementation thereof,
51 | including any amended or successor version of such directive); and
52 |
53 | vii. other similar, equivalent or corresponding rights throughout the world
54 | based on applicable law or treaty, and any national implementations thereof.
55 |
56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59 | and Related Rights and associated claims and causes of action, whether now
60 | known or unknown (including existing as well as future claims and causes of
61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum
62 | duration provided by applicable law or treaty (including future time
63 | extensions), (iii) in any current or future medium and for any number of
64 | copies, and (iv) for any purpose whatsoever, including without limitation
65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66 | the Waiver for the benefit of each member of the public at large and to the
67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver
68 | shall not be subject to revocation, rescission, cancellation, termination, or
69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work
70 | by the public as contemplated by Affirmer's express Statement of Purpose.
71 |
72 | 3. Public License Fallback. Should any part of the Waiver for any reason be
73 | judged legally invalid or ineffective under applicable law, then the Waiver
74 | shall be preserved to the maximum extent permitted taking into account
75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76 | is so judged Affirmer hereby grants to each affected person a royalty-free,
77 | non transferable, non sublicensable, non exclusive, irrevocable and
78 | unconditional license to exercise Affirmer's Copyright and Related Rights in
79 | the Work (i) in all territories worldwide, (ii) for the maximum duration
80 | provided by applicable law or treaty (including future time extensions), (iii)
81 | in any current or future medium and for any number of copies, and (iv) for any
82 | purpose whatsoever, including without limitation commercial, advertising or
83 | promotional purposes (the "License"). The License shall be deemed effective as
84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the
85 | License for any reason be judged legally invalid or ineffective under
86 | applicable law, such partial invalidity or ineffectiveness shall not
87 | invalidate the remainder of the License, and in such case Affirmer hereby
88 | affirms that he or she will not (i) exercise any of his or her remaining
89 | Copyright and Related Rights in the Work or (ii) assert any associated claims
90 | and causes of action with respect to the Work, in either case contrary to
91 | Affirmer's express Statement of Purpose.
92 |
93 | 4. Limitations and Disclaimers.
94 |
95 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
96 | surrendered, licensed or otherwise affected by this document.
97 |
98 | b. Affirmer offers the Work as-is and makes no representations or warranties
99 | of any kind concerning the Work, express, implied, statutory or otherwise,
100 | including without limitation warranties of title, merchantability, fitness
101 | for a particular purpose, non infringement, or the absence of latent or
102 | other defects, accuracy, or the present or absence of errors, whether or not
103 | discoverable, all to the greatest extent permissible under applicable law.
104 |
105 | c. Affirmer disclaims responsibility for clearing rights of other persons
106 | that may apply to the Work or any use thereof, including without limitation
107 | any person's Copyright and Related Rights in the Work. Further, Affirmer
108 | disclaims responsibility for obtaining any necessary consents, permissions
109 | or other rights required for any use of the Work.
110 |
111 | d. Affirmer understands and acknowledges that Creative Commons is not a
112 | party to this document and has no duty or obligation with respect to this
113 | CC0 or use of the Work.
114 |
115 | For more information, please see
116 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # hashTabber
2 |
3 | This is a simple JavaScript plugin for hashchange-driven tabbed navigation system. I was constantly in need of those, so I finally made a kinda-plugin.
4 |
5 | You can read more at [hashtabber.magicznyleszek.xyz](http://hashtabber.magicznyleszek.xyz).
6 |
7 |
8 | ## Contact
9 |
10 | You can contact me at [leszek@magicznyleszek.xyz](mailto:leszek@magicznyleszek.xyz).
11 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | # description
2 | name: "HashTabber"
3 | description: "A simple JavaScript plugin for hashchange-driven tabbed navigation"
4 | keywords: "vanilla, javascript, plugin, hashchange, tab, navigation"
5 | author: "Leszek Pietrzak"
6 |
7 | # address settings
8 | baseurl: http://hashtabber.magicznyleszek.xyz
9 | permalink: /post/:title
10 |
11 | # site configuration
12 | encoding: UTF-8
13 | markdown: rdiscount
14 | future: true
15 | paginate: 9000
16 |
--------------------------------------------------------------------------------
/_data/dinosaurs.yml:
--------------------------------------------------------------------------------
1 | - name: Trilobite
2 | slug: trilobite
3 | url: http://en.wikipedia.org/wiki/Trilobite
4 | description: "Trilobites are a well-known fossil group of extinct marine arthropods that form the class Trilobita. Trilobites form one of the earliest known groups of arthropods. The first appearance of trilobites in the fossil record defines the base of the Atdabanian stage of the Early Cambrian period (521 million years ago), and they flourished throughout the lower Paleozoic era before beginning a drawn-out decline to extinction when, during the Devonian, all trilobite orders except Proetida died out. Trilobites finally disappeared in the mass extinction at the end of the Permian about 250 million years ago. The trilobites were among the most successful of all early animals, roaming the oceans for over 270 million years."
5 |
6 | - name: Velociraptor
7 | slug: velociraptor
8 | url: http://en.wikipedia.org/wiki/Velociraptor
9 | description: "Velociraptor is a genus of dromaeosaurid theropod dinosaur that lived approximately 75 to 71 million years ago during the later part of the Cretaceous Period.Two species are currently recognized, although others have been assigned in the past. The type species is V. mongoliensis; fossils of this species have been discovered in Mongolia. A second species, V. osmolskae, was named in 2008 for skull material from Inner Mongolia, China."
10 |
11 | - name: Pterosaur
12 | slug: pterosaur
13 | url: http://en.wikipedia.org/wiki/Pterosaur
14 | description: "Pterosaurs were flying reptiles of the clade or order Pterosauria. They existed from the late Triassic to the end of the Cretaceous Period (228 to 66 million years ago). Pterosaurs are the earliest vertebrates known to have evolved powered flight. Their wings were formed by a membrane of skin, muscle, and other tissues stretching from the ankles to a dramatically lengthened fourth finger. Early species had long, fully toothed jaws and long tails, while later forms had a highly reduced tail, and some lacked teeth. Many sported furry coats made up of hair-like filaments known as pycnofibres, which covered their bodies and parts of their wings. Pterosaurs spanned a wide range of adult sizes, from the very small Nemicolopterus to the largest known flying creatures of all time, including Quetzalcoatlus and Hatzegopteryx."
15 |
16 | - name: Lambeosaurus magnicristatus
17 | slug: lambeosaurus
18 | url: http://en.wikipedia.org/wiki/Lambeosaurus_magnicristatus
19 | description: "Lambeosaurus is a genus of hadrosaurid dinosaur that lived about 76 to 75 million years ago, in the Late Cretaceous period (Campanian) of North America. This bipedal/quadrupedal, herbivorous dinosaur is known for its distinctive hollow cranial crest, which in the best-known species resembled a hatchet. Several possible species have been named, from Canada, the United States, and Mexico, but only the two Canadian species are currently recognized as valid."
20 |
21 | - name: Eoraptor
22 | slug: eoraptor
23 | url: http://en.wikipedia.org/wiki/Eoraptor
24 | description: "Eoraptor was one of the world's earliest dinosaurs that lived ca. 231.4 million years ago, during the latter part of the Triassic Period in Western Gondwana, what is now the northwestern region of Argentina. It was a small sized (1 m (3.3 ft) long), lightly-built, ground-dwelling, two-legged bipedal saurischian, close to the ancestry of both theropods and sauropodomorphs. It is known from several well-preserved skeletons. When first described in 1993, it was considered to be one of the earliest, if not the earliest known dinosaur. Eoraptor has heterodont dentition, suggesting that it was omnivorous, and that this feeding strategy had evolved early on in dinosaurs."
--------------------------------------------------------------------------------
/_data/philosophers.yml:
--------------------------------------------------------------------------------
1 | - name: Baruch Spinoza
2 | slug: spinoza
3 | url: http://en.wikipedia.org/wiki/Baruch_Spinoza
4 | description: "Baruch Spinoza (/bəˈruːk spɪˈnoʊzə/; born Benedito de Espinosa; 24 November 1632 – 21 February 1677) — later Benedict de Spinoza — was a Dutch philosopher. The breadth and importance of Spinoza's work was not fully realized until years after his death. By laying the groundwork for the 18th century Enlightenment and modern biblical criticism, including modern conceptions of the self and, arguably, the universe, he came to be considered one of the great rationalists of 17th-century philosophy. His magnum opus, the posthumous Ethics, in which he opposed Descartes's mind–body dualism, has earned him recognition as one of Western philosophy's most important thinkers. In the Ethics, \"Spinoza wrote the last indisputable Latin masterpiece, and one in which the refined conceptions of medieval philosophy are finally turned against themselves and destroyed entirely.\" Philosopher Georg Wilhelm Friedrich Hegel said of all contemporary philosophers, \"You are either a Spinozist or not a philosopher at all.\""
5 |
6 | - name: Socrates
7 | slug: socrates
8 | url: http://en.wikipedia.org/wiki/Socrates
9 | description: "Socrates (/ˈsɒkrətiːz/;[2] Greek: Σωκράτης, Ancient Greek pronunciation: [sɔːkrátɛːs], Sōkrátēs; 470/469 BC – 399 BC) was a classical Greek (Athenian) philosopher. Credited as one of the founders of Western philosophy, he is an enigmatic figure known chiefly through the accounts of later classical writers, especially the writings of his students Plato and Xenophon and the plays of his contemporary Aristophanes. Many would claim that Plato's dialogues are the most comprehensive accounts of Socrates to survive from antiquity."
10 |
11 | - name: Friedrich Nietzsche
12 | slug: nietzsche
13 | url: http://en.wikipedia.org/wiki/Friedrich_Nietzsche
14 | description: "Friedrich Wilhelm Nietzsche (/ˈniːtʃə/ or /ˈnitʃi/; German: [ˈfʁiːdʁɪç ˈvɪlhɛlm ˈniːt͡sʃə]; 15 October 1844 – 25 August 1900) was a German philologist, philosopher, cultural critic, poet and composer. He wrote several critical texts on religion, morality, contemporary culture, philosophy and science, displaying a fondness for metaphor, irony and aphorism."
15 |
16 | - name: Marquis de Sade
17 | slug: desade
18 | url: http://en.wikipedia.org/wiki/Marquis_de_Sade
19 | description: "Donatien Alphonse François de Sade (2 June 1740 – 2 December 1814), better known as the Marquis de Sade (French: [maʁki də sad]), was a French aristocrat, revolutionary politician, philosopher and writer, famous for his libertine sexuality. His works include novels, short stories, plays, dialogues and political tracts; in his lifetime some were published under his own name, while others appeared anonymously and Sade denied being their author. He is best known for his erotic works, which combined philosophical discourse with pornography, depicting sexual fantasies with an emphasis on violence, criminality and blasphemy against the Catholic Church. He was a proponent of extreme freedom, unrestrained by morality, religion or law. The words \"sadism\" and \"sadist\" are derived from his name."
--------------------------------------------------------------------------------
/_includes/examples/hashTabber-example-code-html.liquid:
--------------------------------------------------------------------------------
1 | <ol class="hashTabber-nav" data-hashtabber-id="foo">
2 | <li><a>First item</a></li>
3 | <li><a>Second item</a></li>
4 | <li><a>Third item</a></li>
5 | </ol>
6 | <ol class="hashTabber-data" data-hashtabber-id="foo">
7 | <li>This is the first item content.</li>
8 | <li>This is the second item content.</li>
9 | <li>This is the third item content.</li>
10 | </ol>
--------------------------------------------------------------------------------
/_includes/examples/hashTabber-example-code-js-options.liquid:
--------------------------------------------------------------------------------
1 | var tabber = new HashTabber(options = {
2 | classActive: 'active',
3 | classData: 'hashTabber-data',
4 | classNav: 'hashTabber-nav',
5 | dataDefault: 'data-hashtabber-default',
6 | dataId: 'data-hashtabber-id',
7 | dataPair: 'data-hashtabber-pair',
8 | });
--------------------------------------------------------------------------------
/_includes/examples/hashTabber-example-code-js-run.liquid:
--------------------------------------------------------------------------------
1 | var tabber = new HashTabber();
2 | tabber.run();
--------------------------------------------------------------------------------
/_includes/examples/hashTabber-example-naked.liquid:
--------------------------------------------------------------------------------
1 |
2 | {% for philosopher in site.data.philosophers %}
3 |
This is a simple JavaScript plugin for a hashchange-driven tabbed content switcher. Personally I'm not a tabsphiliac, but I needed those a few times recently and decided to make a semi-universal solution.
hashTabber.js – with a single object inside and four helper functions; so you could as well just paste it to your script.js to avoid an unnecessary HTML request
41 |
_hashTabber.scss – 20-something lines of code that would be best to just @include in your global.scss
42 |
43 |
44 |
Build a html HashTabber section with this basic setup:
45 |
46 |
{% include examples/hashTabber-example-code-html.liquid %}
47 |
48 |
Important things for the whole thing to work are:
49 |
50 |
51 |
data attribute – the script will be pairing ol.hashTabber-nav and ol.hashTabber-data elements that share the data-hashtabber-id attribute value, and will use it to generate links for tabs
52 |
children – the script assumes that ol.hashTabber-nav and ol.hashTabber-data both have immediate child nodes li, and pairs up two of them with the same index or a special pair-name attribute
53 |
links – every navigation list element ol.hashTabber-nav > li needs to have an immediate child node a for #foo=tab hrefs creation
54 |
55 |
56 |
Then just run the damn thing:
57 |
58 |
{% include examples/hashTabber-example-code-js-run.liquid %}
59 |
60 |
If the content changes after HashTabber was triggered, you can just use the .run() method again.
61 |
62 |
63 |
Options
64 |
65 |
For some special situations you can define any of the options for classes and data attributes names through the hashTabber()options object parameter:
66 |
67 |
{% include examples/hashTabber-example-code-js-options.liquid %}
68 |
69 |
You can define some special options through the HTML data attributes:
70 |
71 |
72 |
data-hashtabber-default – defined for ol.hashTabber-nav changes the default tab from 0 to given value (a number or a pair-name)
73 |
data-hashtabber-pair – defined for two lis from both ols gives them a special #foo=name link instead of a standard numerical one
74 |
75 |
76 |
77 |
Hidden features
78 |
79 |
It's also worth to mention, that:
80 |
81 |
82 |
Both ols could contain countless different nodes (h2 for example), as the script takes into account only lis inside of them
83 |
Both ols could be placed within completely diffrent HTML nodes, as the script uses the data-hashtabber-id attribute to pair them
84 |
You can chain parameters in links: #foo=2&bar=1&fum=baz&qux=2&zot=3, to switch tabs for all instances of HashTabber simultaneously
85 |
86 |
87 |
88 |
Themes
89 |
90 |
This is something rather varied, but with theming, I would personally go with an additional hashTabber-themename class for both ols. This blank example could be a good start:
91 |
92 |
{% include examples/hashTabber-example-theme-blank.liquid %}
93 |
94 |
95 |
Examples
96 |
97 |
Below is an example with basic theming applied. Notice that you could use an outside #dinosaurs=velociraptor link to change the tab.