Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Hwang committed Jun 17, 2015
1 parent b5f7149 commit ea1f68b
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .hsdoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Tether"
description: "Marrying DOM elements for life"
domain: "tether.io"
source: "coffee/*.coffee"
examples: "**/*.md"
assets: "{deps/*,*.js,*.coffee,css/*.css,docs/css/*.css,docs/js/*,js,docs/welcome/*,examples/*}"
domain: "tether.io"
assets: "{dist/js/*.js,dist/css/*.css,docs/css/*.css,docs/js/*,js,docs/welcome/*,examples/*}"
4 changes: 2 additions & 2 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src="tether.js"></script>
<script src="js/markAttachment.js"></script>
<script src="dist/js/tether.js"></script>
<script src="docs/js/markAttachment.js"></script>
<script src="docs/js/intro.js"></script>
<link rel="stylesheet" href="docs/css/intro.css"></link>

Expand Down
51 changes: 51 additions & 0 deletions docs/js/markAttachment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* globals Tether */

'use strict';

Tether.modules.push({
initialize: function initialize() {
var _this = this;

this.markers = {};

['target', 'element'].forEach(function (type) {
var el = document.createElement('div');
el.className = _this.getClass('' + type + '-marker');

var dot = document.createElement('div');
dot.className = _this.getClass('marker-dot');
el.appendChild(dot);

_this[type].appendChild(el);

_this.markers[type] = { dot: dot, el: el };
});
},

position: function position(_ref) {
var manualOffset = _ref.manualOffset;
var manualTargetOffset = _ref.manualTargetOffset;

var offsets = {
element: manualOffset,
target: manualTargetOffset
};

for (var type in offsets) {
var offset = offsets[type];
for (var side in offset) {
var val = offset[side];
var notString = typeof val !== 'string';
if (notString || val.indexOf('%') === -1 && val.indexOf('px') === -1) {
val += 'px';
}

if (this.markers[type].dot.style[side] !== val) {
this.markers[type].dot.style[side] = val;
}
}
}

return true;
}
});
12 changes: 6 additions & 6 deletions docs/welcome/browser-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>

<!-- Drop themes -->
<link rel="stylesheet" href="/tether/css/tether-theme-arrows-dark.css" />
<link rel="stylesheet" href="/dist/css/tether-theme-arrows-dark.css" />

<!-- Browser demo styles -->
<link rel="stylesheet" href="/tether/docs/welcome/css/browser-demo.css" />
<link rel="stylesheet" href="/docs/welcome/css/browser-demo.css" />
</head>
<body>
<div class="browser-demo">
Expand Down Expand Up @@ -66,11 +66,11 @@
</div>

<!-- Tether javascript -->
<script src="/tether/tether.min.js"></script>
<script src="/dist/js/tether.min.js"></script>

<!-- Welcome docs javascript -->
<script src="/tether/docs/welcome/js/log.js"></script>
<script src="/tether/docs/welcome/js/jquery.js"></script>
<script src="/tether/docs/welcome/js/drop.js"></script>
<script src="/docs/welcome/js/log.js"></script>
<script src="/docs/welcome/js/jquery.js"></script>
<script src="/docs/welcome/js/drop.js"></script>
</body>
</html>
26 changes: 13 additions & 13 deletions docs/welcome/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>

<!-- Tether themes -->
<link rel="stylesheet" href="/tether/css/tether-theme-arrows-dark.css" />
<link rel="stylesheet" href="/dist/css/tether-theme-arrows-dark.css" />

<!-- Welcome docs styles -->
<link rel="stylesheet" href="/tether/docs/welcome/css/prism.css" />
<link rel="stylesheet" href="/tether/docs/welcome/css/welcome.css" />
<link rel="stylesheet" href="/docs/welcome/css/prism.css" />
<link rel="stylesheet" href="/docs/welcome/css/welcome.css" />

<!-- OS icons -->
<link rel="stylesheet" href="http://github.hubspot.com/os-icons/os-icons.css" />
Expand Down Expand Up @@ -105,7 +105,7 @@ <h2>Play with Tether</h2>
<div class="section-scroll-copy-inner">
<p class="example-paragraph">Interact with this demo.</p>
<p>&nbsp;</p>
<p>To learn more, check out our <a href="/tether">documentation</a>.</p>
<p>To learn more, check out our <a href="/">documentation</a>.</p>
</div>
</div>
</td></tr></table>
Expand All @@ -119,22 +119,22 @@ <h2>Play with Tether</h2>
<h1>Tether Family</h1>
<h2>These projects are all powered by Tether's positioning engine.</h2>
<div class="projects-list">
<a href="/drop/docs/welcome" class="project">
<a href="//github.hubspot.com/drop/docs/welcome" class="project">
<h1>Drop</h1>
<span class="os-icon drop-icon"></span>
<p>Create dropdowns, popovers, and more.</p>
</a>
<a href="/tooltip/docs/welcome" class="project">
<a href="//github.hubspot.com/tooltip/docs/welcome" class="project">
<h1>Tooltip</h1>
<span class="os-icon tooltip-icon"></span>
<p>Stylable tooltips built on Tether.</p>
</a>
<a href="/select/docs/welcome" class="project">
<a href="//github.hubspot.com/select/docs/welcome" class="project">
<h1>Select</h1>
<span class="os-icon select-icon"></span>
<p>Stylable select elements built on Tether.</p>
</a>
<a href="/shepherd/docs/welcome" class="project">
<a href="//github.hubspot.com/shepherd/docs/welcome" class="project">
<h1>Shepherd</h1>
<span class="os-icon shepherd-icon"></span>
<p>Guide your users through a tour of your app.</p>
Expand Down Expand Up @@ -194,13 +194,13 @@ <h2>Help us spread the word.</h2>
</td></tr></table>

<!-- Tether javascript -->
<script src="/tether/tether.min.js"></script>
<script src="/dist/js/tether.min.js"></script>

<!-- Welcome docs javascript -->
<script src="/tether/docs/welcome/js/log.js"></script>
<script src="/tether/docs/welcome/js/jquery.js"></script>
<script src="/tether/docs/welcome/js/drop.js"></script>
<script src="/tether/docs/welcome/js/welcome.js"></script>
<script src="/docs/welcome/js/log.js"></script>
<script src="/docs/welcome/js/jquery.js"></script>
<script src="/docs/welcome/js/drop.js"></script>
<script src="/docs/welcome/js/welcome.js"></script>

<!-- HubSpot analytics -->
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion examples/content-visible/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
</div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.element',
Expand Down
2 changes: 1 addition & 1 deletion examples/dolls/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet" href="./dolls.css" />
<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script src="./dolls.js"></script>
<body>
<div class="scroll">
Expand Down
2 changes: 1 addition & 1 deletion examples/element-scroll/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
}
</style>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
var pointer = document.querySelector('.pointer');
var scroll = document.querySelector('.scroll');
Expand Down
2 changes: 1 addition & 1 deletion examples/enable-disable/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="pad"></div>
</div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
var tether = new Tether({
element: '.element',
Expand Down
2 changes: 1 addition & 1 deletion examples/out-of-bounds/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="element"></div>
<div class="target"></div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.element',
Expand Down
2 changes: 1 addition & 1 deletion examples/pin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="element"></div>
<div class="target"></div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.element',
Expand Down
2 changes: 1 addition & 1 deletion examples/scroll/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ <h3>Chapter IV</h3>

<div class="pointer"></div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.pointer',
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="element"></div>
<div class="target"></div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.element',
Expand Down
2 changes: 1 addition & 1 deletion examples/testbed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="pad"></div>
</div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.element',
Expand Down
2 changes: 1 addition & 1 deletion examples/viewport/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
to use <code>position: fixed</code>.</p>
</div>

<script src="../../tether.js"></script>
<script src="/dist/js/tether.js"></script>
<script>
new Tether({
element: '.element',
Expand Down
10 changes: 5 additions & 5 deletions src/js/markAttachment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals TetherBase */
/* globals Tether */

TetherBase.modules.push({
Tether.modules.push({
initialize() {
this.markers = {};

Expand Down Expand Up @@ -29,9 +29,9 @@ TetherBase.modules.push({
for (let side in offset) {
let val = offset[side];
const notString = typeof val !== 'string';
const notPercent = val.indexOf('%') === -1;
const notPixel = val.indexOf('px') === -1;
if (notString || (notPercent && notPixel)) {
if (notString ||
val.indexOf('%') === -1 &&
val.indexOf('px') === -1) {
val += 'px';
}

Expand Down

0 comments on commit ea1f68b

Please sign in to comment.