slice up
This commit is contained in:
parent
19dba40ec8
commit
af6c58bcaa
4 changed files with 6 additions and 20 deletions
|
@ -73,7 +73,7 @@ Ox.load('Image', function() {
|
||||||
/*
|
/*
|
||||||
We split the path in two parts.
|
We split the path in two parts.
|
||||||
*/
|
*/
|
||||||
parts = [Ox.sub(path, 0, i + 1), Ox.sub(path, i + 1)];
|
parts = [path.slice(0, i + 1), path.slice(i + 1)];
|
||||||
/*
|
/*
|
||||||
We get the lat/lng of the points where the line leaves
|
We get the lat/lng of the points where the line leaves
|
||||||
and enters the map...
|
and enters the map...
|
||||||
|
|
2
index.js
2
index.js
|
@ -607,7 +607,7 @@ Ox.load(function() {
|
||||||
},
|
},
|
||||||
url: {
|
url: {
|
||||||
get: function() {
|
get: function() {
|
||||||
var split = window.location.hash.substr(1).split('/');
|
var split = window.location.hash.slice(1).split('/');
|
||||||
return {page: split[0], item: split[1] || ''};
|
return {page: split[0], item: split[1] || ''};
|
||||||
},
|
},
|
||||||
set: function(data) {
|
set: function(data) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<p><b>OxJS</b> (pronounced oh-ex-jay-ess) is a new JavaScript library. It was originially developed as part of <a href="http://pan.do/ra">pan.do/ra</a>, and is currently awaiting its first proper release. While it still has bugs, holes, design errors and lots of cruft, some parts of it may already be useful for a more general audience.</p>
|
<p><b>OxJS</b> (pronounced oh-ex-jay-ess) is a new JavaScript library. It was originially developed as part of <a href="http://pan.do/ra">pan.do/ra</a>, and is currently awaiting its first proper release. While it still has bugs, holes, design errors and lots of cruft, some parts of it may already be useful for a more general audience.</p>
|
||||||
|
|
||||||
<p>The core of <b>OxJS</b> is <code>Ox.js</code>, a general-purpose utility library (think underscore.js, but quite different). It provides <a href="#doc/Ox.isLeapYear">lots</a> <a href="#doc/Ox.parseDate">of</a> <a href="#doc/Ox.getFirstDayOfTheYear">tools</a> <a href="#doc/Ox.getDaysInMonth">for</a> <a href="#doc/Ox.getTimezoneOffset">dealing</a> <a href="#doc/Ox.getDaysInYear">with</a> <a href="#doc/Ox.formatDate">dates</a>, <a href="#doc/Ox.asinh">has</a> <a href="#doc/Ox.deg">all</a> <a href="#doc/Ox.log">the</a> <a href="#doc/Ox.mod">missing</a> <a href="#doc/Ox.rad">Math</a> <a href="#doc/Ox.sinh">functions</a> (<a href="#doc/Ox.getArea">plus</a> <a href="#doc/Ox.getDistance">some</a> <a href="#doc/Ox.joinAreas">for</a> <a href="#doc/Ox.getXYByLatLng">geographic</a> <a href="#doc/getDegreesPerMeter">coordinates</a>), methods like <a href="#doc/Ox.range">range</a> or <a href="#doc/Ox.sub">sub</a> for those who like Python (and even <a href="#doc/Ox.forEach">some</a> <a href="#doc/Ox.loop">options</a> for those who never want to write a <code>for</code> loop again), can <a href="#doc/Ox.tokenize">tokenize</a> and <a href="#doc/Ox.minify">minify</a> JavaScript, comes with its own <a href="#doc/Ox.doc">documentation format</a>, including <a href="#doc/Ox.test">inline tests</a>, and can do about <a href="#readme/23_cool_things_you_can_do_with_oxjs">23 other cool things</a>.</p>
|
<p>The core of <b>OxJS</b> is <code>Ox.js</code>, a general-purpose utility library (think underscore.js, but quite different). It provides <a href="#doc/Ox.isLeapYear">lots</a> <a href="#doc/Ox.parseDate">of</a> <a href="#doc/Ox.getFirstDayOfTheYear">tools</a> <a href="#doc/Ox.getDaysInMonth">for</a> <a href="#doc/Ox.getTimezoneOffset">dealing</a> <a href="#doc/Ox.getDaysInYear">with</a> <a href="#doc/Ox.formatDate">dates</a>, <a href="#doc/Ox.asinh">has</a> <a href="#doc/Ox.deg">all</a> <a href="#doc/Ox.log">the</a> <a href="#doc/Ox.mod">missing</a> <a href="#doc/Ox.rad">Math</a> <a href="#doc/Ox.sinh">functions</a> (<a href="#doc/Ox.getArea">plus</a> <a href="#doc/Ox.getDistance">some</a> <a href="#doc/Ox.joinAreas">for</a> <a href="#doc/Ox.getXYByLatLng">geographic</a> <a href="#doc/getDegreesPerMeter">coordinates</a>), methods like <a href="#doc/Ox.range">range</a> for those who like Python (and even <a href="#doc/Ox.forEach">some</a> <a href="#doc/Ox.loop">options</a> for those who never want to write a <code>for</code> loop again), can <a href="#doc/Ox.tokenize">tokenize</a> and <a href="#doc/Ox.minify">minify</a> JavaScript, comes with its own <a href="#readme/OxDoc">documentation format</a>, including <a href="#doc/Ox.test">inline tests</a>, and can do about <a href="#readme/23_cool_things_you_can_do_with_oxjs">23 other cool things</a>.</p>
|
||||||
|
|
||||||
<p>Then there are modules, most notably <code>Ox.UI</code>, a user interface library for HTML5-compliant browsers (think YUI, but again rather different). <code>Ox.UI</code> has tons of widgets: <a href="#doc/Ox.Input">all</a> <a href="#doc/Ox.DateTimeInput">the</a> <a href="#doc/Ox.PlacePicker">form</a> <a href="#doc/Ox.TimeInput">elements</a> <a href="#doc/Ox.Range">you</a> <a href="#doc/Ox.ColorPicker">ever</a> <a href="#doc/Ox.CheckboxGroup">wanted</a>, resizable <a href="#doc/Ox.SplitPanel">panels</a> and <a href="#doc/Ox.Dialog">dialogs</a>, <a href="#doc/Ox.MainMenu">menus</a> that actually work, <a href="#doc/Ox.IconList">lists</a> and <a href="#doc/Ox.TextList">tables</a> that can hold a million items, <a href="#doc/Ox.Map">maps</a> and <a href="#doc/Ox.Calendar">calendars</a> done right, and a great <a href="#doc/Ox.VideoPlayer">video player</a>. All these widgets are designed to that you can focus on your application and argue less with the DOM. And if you need to, <a href="#doc/Ox.Element">each of them</a> provides, by virtue of <a href="#readme/ParasiticalInheritance">parasitical inheritance</a>, the exact same API as a <a href="#doc/Ox.JQueryElement">jQuery DOM object</a>. But <code>Ox.UI</code> also provides a framework to bring these elements together, including <a href="#doc/Ox.Event">custom</a> <a href="#doc/Ox.Event">events</a>, <a href="#doc/Ox.Keyboard">keyboard</a> <a href="#doc/Ox.Focus">focus</a>, remote <a href="#doc/Ox.API">API</a> discovery and client-side <a href="#doc/Ox.URL">URL</a> handling. It is ideal for real applications with back-ends that speak JSON and don't serve any HTML beyond <code><body></body></code>.</p>
|
<p>Then there are modules, most notably <code>Ox.UI</code>, a user interface library for HTML5-compliant browsers (think YUI, but again rather different). <code>Ox.UI</code> has tons of widgets: <a href="#doc/Ox.Input">all</a> <a href="#doc/Ox.DateTimeInput">the</a> <a href="#doc/Ox.PlacePicker">form</a> <a href="#doc/Ox.TimeInput">elements</a> <a href="#doc/Ox.Range">you</a> <a href="#doc/Ox.ColorPicker">ever</a> <a href="#doc/Ox.CheckboxGroup">wanted</a>, resizable <a href="#doc/Ox.SplitPanel">panels</a> and <a href="#doc/Ox.Dialog">dialogs</a>, <a href="#doc/Ox.MainMenu">menus</a> that actually work, <a href="#doc/Ox.IconList">lists</a> and <a href="#doc/Ox.TextList">tables</a> that can hold a million items, <a href="#doc/Ox.Map">maps</a> and <a href="#doc/Ox.Calendar">calendars</a> done right, and a great <a href="#doc/Ox.VideoPlayer">video player</a>. All these widgets are designed to that you can focus on your application and argue less with the DOM. And if you need to, <a href="#doc/Ox.Element">each of them</a> provides, by virtue of <a href="#readme/ParasiticalInheritance">parasitical inheritance</a>, the exact same API as a <a href="#doc/Ox.JQueryElement">jQuery DOM object</a>. But <code>Ox.UI</code> also provides a framework to bring these elements together, including <a href="#doc/Ox.Event">custom</a> <a href="#doc/Ox.Event">events</a>, <a href="#doc/Ox.Keyboard">keyboard</a> <a href="#doc/Ox.Focus">focus</a>, remote <a href="#doc/Ox.API">API</a> discovery and client-side <a href="#doc/Ox.URL">URL</a> handling. It is ideal for real applications with back-ends that speak JSON and don't serve any HTML beyond <code><body></body></code>.</p>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ Ox.forEach(bigArray, function(v, i) {
|
||||||
// before:
|
// before:
|
||||||
var exists = array.indexOf(value) > -1;
|
var exists = array.indexOf(value) > -1;
|
||||||
// after:
|
// after:
|
||||||
var exists = Ox.in(array, value);
|
var exists = Ox.contains(array, value);
|
||||||
|
|
||||||
// before:
|
// before:
|
||||||
var key;
|
var key;
|
||||||
|
@ -50,20 +50,6 @@ arrayWithLongName[arrayWithLongName.length - 1] = 0;
|
||||||
// after:
|
// after:
|
||||||
Ox.last(arrayWithLongName, 0);
|
Ox.last(arrayWithLongName, 0);
|
||||||
|
|
||||||
// before:
|
|
||||||
myString = myString.substr(2, myString.length - 4);
|
|
||||||
// or:
|
|
||||||
myString = myString.substring(2, myString.length - 2);
|
|
||||||
// after:
|
|
||||||
myString = Ox.sub(myString, 2, -2);
|
|
||||||
|
|
||||||
// before:
|
|
||||||
myArray = myArray.filter(function(v, i) {
|
|
||||||
return i > 1 && i < myArray.length - 2;
|
|
||||||
});
|
|
||||||
// after:
|
|
||||||
myArray = Ox.sub(myArray, 2, -2);
|
|
||||||
|
|
||||||
// before:
|
// before:
|
||||||
myNumber = Math.min(Math.max(myNumber, min), max);
|
myNumber = Math.min(Math.max(myNumber, min), max);
|
||||||
// after:
|
// after:
|
||||||
|
|
Loading…
Reference in a new issue