diff --git a/README.md b/README.md index 1f46442..d251abc 100644 --- a/README.md +++ b/README.md @@ -62,21 +62,6 @@ functions: $_.post(url, data_object, callback); -### QS: querystring parsing and serialization for hashbang strings, and pushState urls ### - -**functions:** - -* Parse: - - $_.qs.parse(hb); - -* Set: This function will set the hash url if browser doesn't have history.pushState - - $_.qs.set(key, value); - -* Get: Retrieves the value of the key in the url string - - $_.qs.get(key); ### Store: localstorage wrapper with automatic data serialization ### diff --git a/combine.php b/combine.php index 201e9bd..47c4336 100755 --- a/combine.php +++ b/combine.php @@ -9,7 +9,6 @@ //The name of the source folder $folder = "src"; $src_folder = "{$folder}/modules"; -$core_folder = "{$folder}/core"; $files = array(); @@ -29,7 +28,7 @@ if($dir = opendir($src_folder)) } //Start with the core -$new_file = file_get_contents($core_folder."/core.js") . "\n"; +$new_file = file_get_contents("{$folder}/core.js") . "\n"; //Add the modules diff --git a/docs/code.css b/docs/code.css new file mode 100644 index 0000000..3375058 --- /dev/null +++ b/docs/code.css @@ -0,0 +1,16 @@ +body { + margin: 0; +} +.KEYW { color: #6277AA; font-weight: bold; } +.COMM { color: #008200; } +.NUMB { color: #393;} +.STRN { color: #00d; } +.REGX { color: #339;} +.linenumber { + border-right: 7px solid #8DA6C6; + color: #fff; + font-style: normal; + font-weight: bold; + padding: 0 7px; + background: #6277AA; +} \ No newline at end of file diff --git a/docs/css/all.css b/docs/css/all.css new file mode 100644 index 0000000..c253cb0 --- /dev/null +++ b/docs/css/all.css @@ -0,0 +1,358 @@ +/* TABLE OF CONTENTS: + * - Browser reset + * - HTML elements + * - JsDoc styling + */ + + + + + + +/* + * BEGIN BROWSER RESET + */ + +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,p,pre,form,fieldset,input,textarea,p,blockquote,th,td { + margin:0; + padding:0 +} +html { + height:100%; + overflow:-moz-scrollbars-vertical; + overflow-x:auto +} +table { + border:0; + border-collapse:collapse; + border-spacing:0 +} +fieldset,img { + border:0 +} +address,caption,cite,code,dfn,em,strong,th,var { + font-style:normal; + font-weight:normal +} +em,cite { + font-style:italic +} +strong { + font-weight:bold +} +ol,ul { + list-style:none +} +caption,th { + text-align:left +} +h1,h2,h3,h4,h5,h6 { + font-size:100%; + font-weight:normal; + margin:0; + padding:0 +} +q:before,q:after { + content:'' +} +abbr,acronym { + border:0 +} +section,article,header,footer,nav,aside,hgroup { + display:block +} + +/* + * END BROWSER RESET + */ + + + + + + +/* + * HTML ELEMENTS + */ + +@font-face { + font-family: 'M1m'; + src: url('fonts/mplus-1m-regular-webfont.eot'); + src: local('☺'), url('fonts/mplus-1m-regular-webfont.woff') format('woff'), url('fonts/mplus-1m-regular-webfont.ttf') format('truetype'), url('fonts/mplus-1m-regular-webfont.svg#webfontVd14f4NN') format('svg'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'M1m'; + src: url('fonts/mplus-1m-bold-webfont.eot'); + src: local('☺'), url('fonts/mplus-1m-bold-webfont.woff') format('woff'), url('fonts/mplus-1m-bold-webfont.ttf') format('truetype'), url('fonts/mplus-1m-bold-webfont.svg#webfontIjI5mZqE') format('svg'); + font-weight: bold; + font-style: normal; +} + + + +* { + line-height: 1.4em; +} + +html { + font-size: 100%; +} + +body { + font-size: 0.75em; + padding: 15px 0; + background: #eee; + background-image: -moz-linear-gradient(left, #dddddd, #f9f9f9) fixed; + background-image: -webkit-gradient(linear,left bottom,right bottom,color-stop(0, #dddddd),color-stop(1, #f9f9f9)) fixed; + } + +body, +input, +select, +textarea { + color: #000; + font-family: Arial, Geneva, sans-serif; +} + +a:link, +a:hover, +a:active, +a:visited { + color: #19199e; +} +a:hover, +a:focus { + color: #00f; + text-decoration: none; +} + +p { + margin: 0 0 1.5em 0; +} + +/* + * END HTML ELEMENTS + */ + + + +/* + * BEGIN HACK + */ + +div.containerMain:after, +div.safeBox:after { + content:""; + display:block; + height:0; + clear:both; +} + +/* + * END HACK + */ + + + +/* + * BEGIN JSDOC + */ + +/* Start menu */ +div.index *.heading1 { + margin-bottom: 0.5em; + border-bottom: 1px solid #999999; + font-family: M1m, Arial, sans-serif; + font-size: 1.6em; + letter-spacing: 1px; + line-height: 1.3em; +} + +div.index div.menu { + background-color: #FFFFFF; +} +*+html div.index div.menu { + background-color: #FFFFFF; +} +* html div.index div.menu { + background-color: #FFFFFF; +} + +div.index div.menu div { + text-align: left; +} + +div.index div.menu a { + text-decoration: none; +} +div.index div.menu a:hover { + text-decoration: underline; +} + +div.index ul.classList { + padding-left: 0; +} + +div.index ul.classList a { + display: block; + margin: 1px 0; + padding: 4px 0 2px 10px; + text-indent: -10px; +} + +div.index div.fineprint { + color: #777; + font-size: 0.9em; +} +div.index div.fineprint a { + color: #777; +} +/* End menu */ + + + +/* Start content */ +div.content ul { + padding-left: 0; +} + +div.content *.classTitle { + font-size: 1.2em; + font-weight: bold; + line-height: 1em; +} + +div.content *.classTitle span { + display: block; + font-size: 2em; + letter-spacing: 2px; + line-height: 1em; + padding-top: 5px; + text-shadow: 1px 1px 1px #999999; + word-wrap: break-word; +} + +div.content p.summary { + font-size: 1.25em; +} + +div.content ul *.classname a, +div.content ul *.filename a { + font-family: Consolas, "Courier New", Courier, monospace; + text-decoration: none; + font-weight: bold; +} +div.content ul *.classname a:hover, +div.content ul *.filename a:hover { + text-decoration: underline; +} + +div.content div.props { + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + background: #fff; + background: -moz-linear-gradient(top, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.2)); /* FF3.6 */ + background: -webkit-gradient(linear,left top,left bottom,color-stop(0, rgba(255, 255, 255, 0.7)),color-stop(1, rgba(255, 255, 255, 0.2))); + -moz-box-shadow: 0px 0px 10px #ccc; + -webkit-box-shadow: 0px 0px 5px #bbb; + box-shadow: 0px 0px 5px #bbb; +} + + + +*.sectionTitle { + font-family: M1m, sans-serif; + font-size: 1.6em; + letter-spacing: 1px; +} + +table.summaryTable td, +table.summaryTable th { + vertical-align: top; +} +table.summaryTable tr:last-child td { + padding-bottom: 0; +} + +table.summaryTable th { + font-weight: bold; +} + +table.summaryTable td.attributes { + font-family: Consolas, "Courier New", Courier, monospace; + color: #666; +} + +table.summaryTable td.nameDescription div.fixedFont { + font-weight: bold; +} + +table.summaryTable div.description { + color: #333; +} + + + +dl.detailList dt { + font-weight: bold; +} + +dl.inheritsList dd + dt { + margin-top: 10px; +} + +dl.inheritsList dd { + display: inline; +} + + + +.fixedFont { + font-family: Consolas, "Courier New", Courier, monospace; +} + +.fixedFont.heading { + font-size: 1.25em; + line-height: 1.1em +} + +.fixedFont.heading + .description { + font-size: 1.2em; +} + +.fixedFont.heading .light, +.fixedFont.heading .lighter { + font-weight: bold; +} + +pre.code { + overflow: auto; + font-family: Consolas, "Courier New", Courier, monospace; + background: #eee; +} +/* Start content */ + + + +/* Start general styles */ +.light { + color: #666; +} + +.lighter { + color: #999; +} + +span.break { + font-size: 1px; + line-height: 1px; +} +/* End general styles */ + +/* + * END JSDOC + */ diff --git a/docs/css/fonts/mplus-1m-bold-webfont.eot b/docs/css/fonts/mplus-1m-bold-webfont.eot new file mode 100644 index 0000000..6c64f8d Binary files /dev/null and b/docs/css/fonts/mplus-1m-bold-webfont.eot differ diff --git a/docs/css/fonts/mplus-1m-bold-webfont.svg b/docs/css/fonts/mplus-1m-bold-webfont.svg new file mode 100644 index 0000000..5129512 --- /dev/null +++ b/docs/css/fonts/mplus-1m-bold-webfont.svg @@ -0,0 +1,134 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Foundry URL : http://mplus-fonts.sourceforge.jp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/css/fonts/mplus-1m-bold-webfont.ttf b/docs/css/fonts/mplus-1m-bold-webfont.ttf new file mode 100644 index 0000000..0cf54cb Binary files /dev/null and b/docs/css/fonts/mplus-1m-bold-webfont.ttf differ diff --git a/docs/css/fonts/mplus-1m-bold-webfont.woff b/docs/css/fonts/mplus-1m-bold-webfont.woff new file mode 100644 index 0000000..f90475d Binary files /dev/null and b/docs/css/fonts/mplus-1m-bold-webfont.woff differ diff --git a/docs/css/fonts/mplus-1m-regular-webfont.eot b/docs/css/fonts/mplus-1m-regular-webfont.eot new file mode 100644 index 0000000..a53f8b5 Binary files /dev/null and b/docs/css/fonts/mplus-1m-regular-webfont.eot differ diff --git a/docs/css/fonts/mplus-1m-regular-webfont.svg b/docs/css/fonts/mplus-1m-regular-webfont.svg new file mode 100644 index 0000000..3c835a3 --- /dev/null +++ b/docs/css/fonts/mplus-1m-regular-webfont.svg @@ -0,0 +1,134 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Foundry URL : http://mplus-fonts.sourceforge.jp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/css/fonts/mplus-1m-regular-webfont.ttf b/docs/css/fonts/mplus-1m-regular-webfont.ttf new file mode 100644 index 0000000..684abfd Binary files /dev/null and b/docs/css/fonts/mplus-1m-regular-webfont.ttf differ diff --git a/docs/css/fonts/mplus-1m-regular-webfont.woff b/docs/css/fonts/mplus-1m-regular-webfont.woff new file mode 100644 index 0000000..49585d8 Binary files /dev/null and b/docs/css/fonts/mplus-1m-regular-webfont.woff differ diff --git a/docs/css/handheld.css b/docs/css/handheld.css new file mode 100644 index 0000000..073c0d1 --- /dev/null +++ b/docs/css/handheld.css @@ -0,0 +1,217 @@ +/* + * TABLE OF CONTENTS: + * - Browser reset + * - HTML elements + * - JsDoc styling + * - Media query check + */ + + + + + + +/* + * HTML ELEMENTS + */ + +body { + padding: 1% 4% 1% 4%; +} + +/* + * HTML ELEMENTS + */ + + + + + +/* + * BEGIN JSDOC + */ + +/* Start menu */ +div.index div.menu { + position: fixed; + top: 0; + right: 0; + -moz-border-radius-bottomleft: 15px; + -webkit-border-bottom-left-radius: 15px; + -border-bottom-left-radius: 15px; + padding: 4px 5px 8px 10px; + -moz-box-shadow: 0px 0px 10px #c4c4c4; + -webkit-box-shadow: 0px 0px 10px #c4c4c4; + box-shadow: 0px 0px 10px #c4c4c4; + background-color: rgba(255, 255, 255, 0.9); +} + +div.index input.classFilter { + display: none; +} + +div.index div.indexLinks a { + float: right; + clear: both; + font-size: 1.1em; +} + +div.index *.heading1 { + display:none; +} + +div.index ul.classList { + display:none; +} + +div.index div.fineprint { + display:none; +} + +div.indexStatic { + display: none; +} +/* End menu */ + + + +/* Start content */ +div.content *.classTitle { + margin-right: 60px; + margin-bottom: 15px; +} + +div.content div.intro { + margin: 15px 0 35px; +} + +div.content p.description.summary { + margin-bottom: 0.2em; +} + +div.content div.props { + margin: 1.5em -2% 0 -2%; + padding: 2%; +} + +table.summaryTable { + position: relative; + left: -10px; + width: 100%; + border-collapse: collapse; + box-sizing: content-box; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + -ms-box-sizing: content-box; + -o-box-sizing: content-box; + -icab-box-sizing: content-box; + -khtml-box-sizing: content-box; +} + +*.sectionTitle { + padding: 0 10px 10px 0; +} +caption.sectionTitle { + padding-left: 10px; +} + +table.summaryTable td, +table.summaryTable th { + padding: 0px 10px 10px 10px; +} +table.summaryTable tr:last-child td { + padding-bottom: 0; +} + +table.summaryTable td.attributes { + width: 35%; +} + +table.summaryTable td.nameDescription { + width: 65% +} + + + +dl.detailList { + margin-top: 0.5em; +} + +dl.detailList.nomargin + dl.detailList.nomargin { + margin-top: 0; +} + +dl.detailList dt { + display: inline; + margin-right: 5px; +} + +dl.detailList dt:before { + display: block; + content: ""; +} + +dl.detailList dd { + display: inline; +} + +dl.detailList.params dt { + display: block; +} +dl.detailList.params dd { + display: block; + padding-left: 2em; + padding-bottom: 0.4em; +} + + + + +ul.fileList li { + margin-bottom: 1.5em; +} + + + +.fixedFont.heading { + margin-bottom: 0.5em; +} + +pre.code { + margin: 10px 0 10px 0; + padding: 10px; + border: 1px solid #ccc; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; +} +/* End content */ + +/* + * END JSDOC + */ + + + + + + + +/* + * START MEDIA QUERY CHECK + */ + +.cssLoadCheck { + position: absolute; + top: -99999px; + left: -99999px; + border: 0; + width: 100px; + padding: 0; + overflow: hidden; +} + +/* + * END MEDIA QUERY CHECK + */ + diff --git a/docs/css/screen.css b/docs/css/screen.css new file mode 100644 index 0000000..8cb4bba --- /dev/null +++ b/docs/css/screen.css @@ -0,0 +1,297 @@ +/* + * TABLE OF CONTENTS: + * - JsDoc styling + * - Media query check + */ + + + + + + +/* + * BEGIN JSDOC + */ + +/* Start menu */ +div.index { + position: fixed; + top: 0; + bottom: 0; + float: left; + width: 30%; + min-width: 100px; + max-width: 300px; + padding: 0 0 10px 0; + overflow: auto; +} + +div.index *.heading1 { + padding: 8px 0 0 0; +} + +div.index div.menu { + margin: 0 15px 0 -15px; + -moz-border-radius-bottomright: 15px; + -webkit-border-bottom-right-radius: 15px; + -border-bottom-right-radius: 15px; + padding: 15px 15px 15px 30px; + -moz-box-shadow: 0px 0px 10px #c4c4c4; + -webkit-box-shadow: 0px 0px 10px #c4c4c4; + box-shadow: 0px 0px 10px #c4c4c4; + background-color: rgba(255, 255, 255, 0.5); +} + +div.index div.indexLinks { + margin-top: 13px; + position: absolute; + right: 30px; +} + +div.index div.indexLinks a { + color: #999999; + text-transform: lowercase; +} + +div.index div.indexLinks a:first-child { + margin-right: 3px; + border-right: 1px solid #999999; + padding-right: 5px; +} + +div.index input.classFilter { + margin-bottom: 4px; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #CCCCCC #999999 #999999 #CCCCCC; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + -border-radius: 3px; +} + +div.index ul.classList a { + line-height: 1.3em; +} + +div.index ul.classList a + a { + margin-left: 0.5em; +} + +div.index div.fineprint { + margin: 1em 0 0 15px; + color: #777; + font-size: 0.9em; +} + +div.index div.fineprint a { + color: #777; +} + +div.indexStatic { + position: static; + min-height: 1em; +} +/* End menu */ + + +/* Start content */ +div.content { + float: left; + width: 70%; + min-width: 300px; + max-width: 600px; +} +div.innerContent { + padding: 0 0 0 2.5em; +} + +div.content ul, +div.content ol { + margin-bottom: 3em; +} + +div.content ul.methodDetail { + margin-bottom: 0; +} + +div.content *.classTitle { + position: relative; + left: -10px; + margin: -30px 0 15px 0; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; + padding: 25px 15px 15px 15px; + background-color: #FFFFFF; + background-color: rgba(255, 255, 255, 0.5); + -moz-box-shadow: 0px 0px 10px #c4c4c4; + -webkit-box-shadow: 0px 0px 10px #c4c4c4; + box-shadow: 0px 0px 10px #c4c4c4; +} + +div.content div.intro { + margin: 15px 0 45px +} + +div.content p.summary { + margin-bottom: 0.5em; +} + +div.content ul.summary { + margin-bottom: 1.5em; +} + +div.content ul *.classname a, +div.content ul *.filename a { + font-family: Consolas, "Courier New", Courier, monospace; + text-decoration: none; + font-weight: bold; +} +div.content ul *.classname a:hover, +div.content ul *.filename a:hover { + text-decoration: underline; +} + +div.content div.props { + position: relative; + left: -10px; + margin-bottom: 2.5em; + padding: 10px 15px 15px 15px; + overflow: hidden; +} + +div.content div.hr { + margin: 0 10px 0 0; + height: 4em; +} + + + +table.summaryTable { + position: relative; + left: -10px; + width: 100%; + border-collapse: collapse; + box-sizing: content-box; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + -ms-box-sizing: content-box; + -o-box-sizing: content-box; + -icab-box-sizing: content-box; + -khtml-box-sizing: content-box; +} + +*.sectionTitle { + padding: 0 10px 10px 0; +} +caption.sectionTitle { + padding-left: 10px; +} + +table.summaryTable td, +table.summaryTable th { + padding: 0px 10px 10px 10px; +} +table.summaryTable tr:last-child td { + padding-bottom: 0; +} + +table.summaryTable td.attributes { + width: 35%; +} + +table.summaryTable td.nameDescription { + width: 65% +} + + + +dl.detailList { + margin-top: 0.5em; +} + +dl.detailList.nomargin + dl.detailList.nomargin { + margin-top: 0; +} + +dl.detailList dt { + display: inline; + margin-right: 5px; +} + +dl.detailList dt:before { + display: block; + content: ""; +} + +dl.detailList dd { + display: inline; +} + +dl.detailList.params dt { + display: block; +} +dl.detailList.params dd { + display: block; + padding-left: 2em; + padding-bottom: 0.4em; +} + + + + +ul.fileList li { + margin-bottom: 1.5em; +} + + + +.fixedFont.heading { + margin-bottom: 0.5em; +} + +pre.code { + margin: 10px 0 10px 0; + padding: 10px; + border: 1px solid #ccc; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; +} +/* End content */ + +.clear { + clear: both; + width: 100%; + min-height: 0; +} + +/* + * END JSDOC + */ + + + + + + + +/* + * START MEDIA QUERY CHECK + */ + +.cssLoadCheck { + position: absolute; + top: -99999px; + left: -99999px; + border: 0; + width: 100px; + padding: 0; + overflow: hidden; +} + +/* + * END MEDIA QUERY CHECK + */ + diff --git a/docs/default.css b/docs/default.css new file mode 100644 index 0000000..184ee4f --- /dev/null +++ b/docs/default.css @@ -0,0 +1,440 @@ +/* --- Basic Layout -------------------------------------------------------- */ +/* For IE for Windows \*/ +* html{ + width: 100%; + height: 100%; + overflow: hidden; +} +* html body{ + width: 100%; + height: 100%; + overflow: auto; +} + +* html .fixed{ + position: absolute; +} +.fixed { + position: fixed; + overflow: auto; +} +/* */ +/* --- Basic Layout -------------------------------------------------------- */ +body { + padding: 0; + margin: 0; + background: #fafafa; + font: 100% Verdana, Arial, Helvetica, sans-serif; +} + +#main { + border-left: 0.625em #356aa0 solid; + margin-left: 16.25em; +} + +#index { + top: 0; + left: 0; + width: 16.25em; + height: 100%; + overflow: auto; + overflow-x: hidden; + border-right: 0.625em solid #356aa0; +} +/* --- General layout ------------------------------------------------------ */ +h1 { + margin: 0.625em 0 0.625em; + font-size: 1.5em; + font-weight: bold; +} + +h1.classTitle { + color: #007b00; + font-size: 1.5em; + line-height:130%; +} + +h2 { + font-size: 1.25em; + color: #6277AA; + margin: 2em 0pt 1em; +} + +h3 { + font-size: 1.1em; + color: #6277AA; +} + +p { + margin: 1em 0; + text-align: justify; +} + +a:link { + color: #001C58; +} + +a:visited { + color: #6277AA; +} + +hr { + border: none 0; + border-top: 0.0625em solid #7f8fb1; + height: 0.0625em; +} + +.invisible { + display: none !important; +} + +.clear { + clear: both; + line-height: 0.0625em; +} + +.description { + font: 0.8125em Verdana, Arial; + line-height: 0.9375em; + padding: 0.25em; + padding-left: 0.25em; +} + +.fineprint { + padding-top: 1.25em; + text-align: right; + font-size: 0.625em; +} + +div.sectionTitle { + background-color: #356aa0; + color: #fff; + font-size: 1.1em; + font-weight: bold; + text-align: left; + padding: 0.125em 0.5em 0.125em 0.5em; + border: 0.0625em #7F8FB1 solid; +} + +/* --- Index toggler ------------------------------------------------------- */ +#index-toggler { + width: 1em; + top: 0.25em; + left: 16.25em; + cursor: pointer; + font-weight: bold; + font-family: Arial; + font-size: 1em; + color: #fff; + z-index: 100; +} +#index-close { + background: url(images/never_translate.png) no-repeat left; + height: 1em; + width: 1em; + float: left; + cursor: pointer; + margin: 0.0625em 0.25em; + display: inline; +} +body.index-collapsed { background-position: 0; } +body.index-collapsed #main { margin-left: 0; } +body.index-collapsed #index { width: 0; } +body.index-collapsed #index-wrapper { display: none; } +body.index-collapsed #index-toggler { left: 0; } + +/* --- Module Filter ------------------------------------------------------- */ +.module-filter { + display: inline; + float: left; + cursor: pointer; + width: 4em; + font-size: 0.8em; + text-align: center; + padding-top: 0.125em; +} +.module-filter, .module-filter a { + text-decoration: none; + color: #007B00 !important; +} +body.filter .sectionItem { display: none; } +body.filter .module-filter, body.filter .module-filter a { color: red !important; } +body.filter.module-core .module-core { display: block; } +body.filter.module-dom .module-dom { display: block; } +body.filter.module-css .module-css { display: block; } +body.filter.module-ajax .module-ajax { display: block; } +body.filter.module-event .module-event { display: block; } + +/* --- Method Toggler ------------------------------------------------------ */ +.method-toggler { + background: url(images/minus.gif) no-repeat left; + cursor: pointer; + float: left; + width: 0.875em; + height: 0.875em; +} +.method-toggler.toggled { + background: url(images/plus.gif) no-repeat left; +} + +/* --- Class Name and File Name Icons -------------------------------------- */ +.itemName .icon, .itemName .icon a { + color: #007B00 !important; +} +.itemName .icon { + font-size: 1em; + font-weight: bold; + padding: 0 0 0.125em 1.5em; +} + +.itemName .icon { + background: url(images/class_obj.png) no-repeat left; +} + +.itemName.namespace .icon { + background-image: url(images/namespace_obj.png) !important; +} + +.itemName.namespace-function .icon { + background-image: url(images/namespace_function_obj.png) !important; +} + +.fileName .icon { + background: url(images/file_obj.png) no-repeat left !important; +} + +/* --- Class Method and Property Icons ------------------------------------- */ +div.classMethod .icon { + padding-left: 1.275em; + background: url(images/method_public_obj.png) no-repeat left; +} + +div.classMethod .private { + background-image: url(images/method_private_obj.png) !important; +} + +div.classProperty .icon { + padding-left: 1.275em; + background: url(images/field_public_obj.png) no-repeat left; +} + +div.classProperty .private { + background-image: url(images/field_private_obj.png) !important; +} + + +/* --- Headers ------------------------------------------------------------- */ +.header { + color: #fff; + font-weight: bold; + font-size: 1.4em; + height: 1.2em; + background: #356aa0; + padding: 0.15em 0.4375em; +} + +#index .header { + padding: 0.5em 0 0 0; + height: 1.625em; + font-size: 1em; + background: #356aa0; +} + +/* --- Main/Index Shared Layouts ------------------------------------------- */ +#content .section { + margin-top: 1.5em; +} + +div.classList { + padding: 0.625em; + font-family: arial, sans-serif; + font-size: 0.75em; +} + +div.sectionItem .signature { + color: #000; + margin-left: 0.250em; + font-weight: normal; +} + +.help, div.sectionItem .signature span { + cursor: help; +} + +/* --- Main layout --------------------------------------------------------- */ +#main .full-description { + font-size: 0.9em; + line-height: 135%; +} + +#main code { + font-size: 1.1em; + font-weight: bold; + color: #666; +} + +html:not([lang*=""]) #main code { + font-size: 1.4em !important; /* Firefox hack */ +} + +#main p p, #main .full-description p, #main span a { + font-size: 1em; +} + +#content { + padding: 0 1.25em 1.25em 1.25em; +} + +#main .sectionItem { + background: #fff; + padding-left: 0.8em; +} + +#main .sectionItem .description { + font-size: 0.8em; + padding-left: 0.4375em; + color: #777; +} + +#main .summary .sectionItems, #main .details .sectionItem { + border: 0.25em #8DA6C6 solid; + padding: 0.625em; +} + +/* --- Summary layout ------------------------------------------------------ */ +#main .summary { + background: #fff; +} + +#main .summary .sectionItems { + border-width: 0.125em 0.125em 0.250em; +} + +#main .summary .sectionItem { + padding: 0 0 0.3em 1.6em; + font-family: Verdana, Arial; + font-size: 0.875em; +} + +#main .summary .sectionItem b { + margin-left: -1.4286em; +} + +#main .summary .module-filter { + margin-left: -5.3571em; +} + +/* --- Details layout ------------------------------------------------------ */ +#main .details .module-filter { + font-size: 70%; +} + +#main .details .sectionItem { + border-width: 0.125em 0.125em 0.250em; + margin-bottom: 0.75em; +} + +#main .details .itemTitle { + color: #001C58; + font-family: Verdana; + font-weight: bold; + font-size: 1em; + display: inline; +} + +#main .details .itemTitle .light { + font-size: 0.9em; +} + +#main .details .full-description { + padding: 0 0.625em; +} + + +.light, .light a:link, .light a:visited { + color: #777; + font-weight: normal; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; +} + +/* --- Details data -------------------------------------------------------- */ +table.methodItem { + font-size: 0.8em; +} +table.methodItem p { + margin: 0; +} +table.methodItem td { + padding: 0 0.1em 0.1em; + vertical-align: text-top; +} +table.methodItem .methodItemType { + text-align: center; +} +div.heading { + color: #6277AA; + font-size: 0.875em; + font-weight: bold; + margin: 0.625em 0 0; +} + +/* --- Index Layout -------------------------------------------------------- */ +#index-wrapper { + width: 100%; +} + +#index-menu { + background: #8DA6C6; + color: #fff; + text-align: center; + padding: 0.125em 0 0.25em; + font-weight: bold; + font-size: 0.9em; +} + +#index-menu a:link, #index-menu a:visited { + color: #fff; +} + +#index-title { + float: left; +} + +#index-content { + background: #fff; + border: 0 #8DA6C6 solid; + border-width: 0 0 0.25em; + font-size: 1.1em; +} + +#index-content .signature { + font-size: 0.85em; +} + +#index .section { + padding-bottom: 0.625em; +} + +/* --- Class index / File index layout ------------------------------------- */ +* html #content.index-page { + width: 92%; /* IE only hack para evitar bug no layout */ +} + +#content.index-page .sectionItem { + padding: 0.125em; +} + +#content.index-page .sectionItems { + border-top-width: 0.125em; +} + +#content.index-page .summary { + margin: 0; +} + +/* --- Hide private members ------------------------------------------------ */ +/* +div.sectionItem.private { + display: none !important; +} +/**/ diff --git a/docs/files.html b/docs/files.html new file mode 100644 index 0000000..0d8cb6c --- /dev/null +++ b/docs/files.html @@ -0,0 +1,129 @@ + + + + + + JsDoc Reference - File Index + + + + + + + + +
+
+
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ +
+ Framework jProton +
+ + +
+ +

File Index

+ +
+
+ +
+ ajax.js ../kis-js/src/modules/event.js + +
+ + +
+
+ +
+ DOM.js ../kis-js/src/modules/event.js + +
+ + +
+
+ +
+ event.js ../kis-js/src/modules/event.js + +
+ + +
+
+ +
+ store.js ../kis-js/src/modules/event.js + +
+ + +
+
+ +
+ util.js ../kis-js/src/modules/event.js + +
+ + +
+
+ +
+
+ +
+ +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+
+
+ + + diff --git a/docs/images/bg.png b/docs/images/bg.png new file mode 100644 index 0000000..2a69cea Binary files /dev/null and b/docs/images/bg.png differ diff --git a/docs/images/class_default_obj.png b/docs/images/class_default_obj.png new file mode 100644 index 0000000..8d42ac8 Binary files /dev/null and b/docs/images/class_default_obj.png differ diff --git a/docs/images/class_obj.png b/docs/images/class_obj.png new file mode 100644 index 0000000..b763245 Binary files /dev/null and b/docs/images/class_obj.png differ diff --git a/docs/images/collapsebtn.gif b/docs/images/collapsebtn.gif new file mode 100644 index 0000000..baa80eb Binary files /dev/null and b/docs/images/collapsebtn.gif differ diff --git a/docs/images/expandbtn.gif b/docs/images/expandbtn.gif new file mode 100644 index 0000000..39737e3 Binary files /dev/null and b/docs/images/expandbtn.gif differ diff --git a/docs/images/field_private_obj.png b/docs/images/field_private_obj.png new file mode 100644 index 0000000..e88e002 Binary files /dev/null and b/docs/images/field_private_obj.png differ diff --git a/docs/images/field_public_obj.png b/docs/images/field_public_obj.png new file mode 100644 index 0000000..6c163f5 Binary files /dev/null and b/docs/images/field_public_obj.png differ diff --git a/docs/images/file_obj.png b/docs/images/file_obj.png new file mode 100644 index 0000000..24ed3ea Binary files /dev/null and b/docs/images/file_obj.png differ diff --git a/docs/images/method_private_obj.png b/docs/images/method_private_obj.png new file mode 100644 index 0000000..bf432c0 Binary files /dev/null and b/docs/images/method_private_obj.png differ diff --git a/docs/images/method_public_obj.png b/docs/images/method_public_obj.png new file mode 100644 index 0000000..a032863 Binary files /dev/null and b/docs/images/method_public_obj.png differ diff --git a/docs/images/minus.gif b/docs/images/minus.gif new file mode 100644 index 0000000..90d1d34 Binary files /dev/null and b/docs/images/minus.gif differ diff --git a/docs/images/namespace_function_obj.png b/docs/images/namespace_function_obj.png new file mode 100644 index 0000000..3b3b7ef Binary files /dev/null and b/docs/images/namespace_function_obj.png differ diff --git a/docs/images/namespace_obj.png b/docs/images/namespace_obj.png new file mode 100644 index 0000000..3021c8a Binary files /dev/null and b/docs/images/namespace_obj.png differ diff --git a/docs/images/never_translate.png b/docs/images/never_translate.png new file mode 100644 index 0000000..204f5e7 Binary files /dev/null and b/docs/images/never_translate.png differ diff --git a/docs/images/plus.gif b/docs/images/plus.gif new file mode 100644 index 0000000..014671f Binary files /dev/null and b/docs/images/plus.gif differ diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..c85bbb0 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,147 @@ + + + + + + JsDoc Reference - Index + + + + + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ +
+ Framework jProton +
+ + +
+ +

Class Index

+ +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + _global_ +
+

+ Global namespace. +

+
+ +
+ +
+
+ +
+
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+
+
+ + + diff --git a/docs/javascript/all.js b/docs/javascript/all.js new file mode 100644 index 0000000..5b6876a --- /dev/null +++ b/docs/javascript/all.js @@ -0,0 +1,326 @@ +/** + * @fileOverview Contains standard code in the namespace 'wbos' and code specifically written for Codeview in the namespace 'codeview' + * @author Wouter Bos (www.thebrightlines.com) + * @since 1.0 - 2010-09-10 + * @version 1.0 - 2010-09-10 + */ + + + + + + +if (typeof(wbos) == "undefined") { + /** + * @namespace Standard code of Wouter Bos (wbos) + */ + wbos = {} +} +if (typeof(wbos.CssTools) == "undefined") { + /** + * @namespace Namespace for CSS-related functionality + */ + wbos.CssTools = {} +} + + + + +/** + * @namespace Fallback for CSS advanced media query + * @class + * @since 1.0 - 2010-09-10 + * @version 1.0 - 2010-09-10 + */ +wbos.CssTools.MediaQueryFallBack = ( function() { + var config = { + cssScreen: "/css/screen.css", + cssHandheld: "/css/handheld.css", + mobileMaxWidth: 660, + testDivClass: "cssLoadCheck", + dynamicCssLinkId: "DynCssLink", + resizeDelay: 30 + } + var noMediaQuery = false; + var delay; + var currentCssMediaType; + + // Adding events to elements in the DOM without overwriting it + function addEvent(element, newFunction, eventType) { + var oldEvent = eval("element." + eventType); + var eventContentType = eval("typeof element." + eventType) + + if ( eventContentType != 'function' ) { + eval("element." + eventType + " = newFunction") + } else { + eval("element." + eventType + " = function(e) { oldEvent(e); newFunction(e); }") + } + } + + // Get the the inner width of the browser window + function getWindowWidth() { + if (window.innerWidth) { + return window.innerWidth; + } else if (document.documentElement.clientWidth) { + return document.documentElement.clientWidth; + } else if (document.body.clientWidth) { + return document.body.clientWidth; + } else{ + return 0; + } + } + + function addCssLink(cssHref) { + var cssNode = document.createElement('link'); + var windowWidth; + cssNode.type = 'text/css'; + cssNode.rel = 'stylesheet'; + cssNode.media = 'screen, handheld, fallback'; + cssNode.href = cssHref; + document.getElementsByTagName("head")[0].appendChild(cssNode); + } + + + + /* Start public */ + return { + /** + * Adds link to CSS in the head if no CSS is loaded + * + * @since 1.0 - 2010-08-21 + * @version 1.0 - 2010-08-21 + * @param {String|Object} cssScreen URL to CSS file for larger screens + * @param {String|Object} cssHandheld URL to CSS file for smaller screens + * @param {Number} mobileMaxWidth Maximum width for handheld devices + * @example + * wbos.CssTools.MediaQueryFallBack.LoadCss(['screen.css', 'screen2.css'], 'mobile.css', 480) + */ + LoadCss: function(cssScreen, cssHandheld, mobileMaxWidth) { + // Set config values + if (typeof(cssScreen) != "undefined") { + config.cssScreen = cssScreen; + } + if (typeof(cssHandheld) != "undefined") { + config.cssHandheld = cssHandheld; + } + if (typeof(mobileMaxWidth) != "undefined") { + config.mobileMaxWidth = mobileMaxWidth; + } + + // Check if CSS is loaded + var cssloadCheckNode = document.createElement('div'); + cssloadCheckNode.className = config.testDivClass; + document.getElementsByTagName("body")[0].appendChild(cssloadCheckNode); + if (cssloadCheckNode.offsetWidth != 100 && noMediaQuery == false) { + noMediaQuery = true; + } + cssloadCheckNode.parentNode.removeChild(cssloadCheckNode) + + if (noMediaQuery == true) { + // Browser does not support Media Queries, so JavaScript will supply a fallback + var cssHref = ""; + + // Determines what CSS file to load + if (getWindowWidth() <= config.mobileMaxWidth) { + cssHref = config.cssHandheld; + newCssMediaType = "handheld"; + } else { + cssHref = config.cssScreen; + newCssMediaType = "screen"; + } + + // Add CSS link to of page + if (cssHref != "" && currentCssMediaType != newCssMediaType) { + var currentCssLinks = document.styleSheets + for (var i = 0; i < currentCssLinks.length; i++) { + for (var ii = 0; ii < currentCssLinks[i].media.length; ii++) { + if (typeof(currentCssLinks[i].media) == "object") { + if (currentCssLinks[i].media.item(ii) == "fallback") { + currentCssLinks[i].ownerNode.parentNode.removeChild(currentCssLinks[i].ownerNode) + i-- + break; + } + } else { + if (currentCssLinks[i].media.indexOf("fallback") >= 0) { + currentCssLinks[i].owningElement.parentNode.removeChild(currentCssLinks[i].owningElement) + i-- + break; + } + } + } + } + if (typeof(cssHref) == "object") { + for (var i = 0; i < cssHref.length; i++) { + addCssLink(cssHref[i]) + } + } else { + addCssLink(cssHref) + } + + currentCssMediaType = newCssMediaType; + } + + + // Check screen size again if user resizes window + addEvent(window, wbos.CssTools.MediaQueryFallBack.LoadCssDelayed, 'onresize') + } + }, + + /** + * Runs LoadCSS after a short delay + * + * @since 1.0 - 2010-08-21 + * @version 1.0 - 2010-08-21 + * @example + * wbos.CssTools.MediaQueryFallBack.LoadCssDelayed() + */ + LoadCssDelayed: function() { + clearTimeout(delay); + delay = setTimeout( "wbos.CssTools.MediaQueryFallBack.LoadCss()", config.resizeDelay) + } + + } + /* End public */ +})(); + + + + + + +/** + * @namespace Adds a function to an event of a single element. Use this if + * you don't want to use jQuery + * @class + * @since 1.0 - 2010-02-23 + * @version 1.0 - 2010-02-23 + */ +wbos.Events = ( function() { + /* Start public */ + return { + /** + * Adds a function to an event of a single element + * + * @since 1.0 - 2010-02-23 + * @version 1.0 - 2010-02-23 + * @param {Object} element The element on which the event is placed + * @param {Function} newFunction The function that has to be linked to the event + * @param {String} eventType Name of the event + * @example + * wbos.Events.AddEvent( document.getElementById('elementId'), functionName, "onclick" ) + */ + AddEvent: function( element, newFunction, eventType ) { + var oldEvent = eval("element." + eventType); + var eventContentType = eval("typeof element." + eventType) + + if ( eventContentType != 'function' ) { + eval("element." + eventType + " = newFunction") + } else { + eval("element." + eventType + " = function(e) { oldEvent(e); newFunction(e); }") + } + } + } + /* End public */ +})(); + + + + + + +if (typeof(codeview) == "undefined") { + /** + * @namespace Code written for the Codeview template + */ + codeview = {} +} + + + + + + + +/** + * @namespace Enables filtering in class lists + * @class + * @since 1.0 - 2010-11-08 + * @version 1.0 - 2010-11-08 + */ +codeview.classFilter = ( function() { + function onkeyup_ClassFilter() { + var listItems + var search = document.getElementById('ClassFilter').value + search = search.toLowerCase() + if (document.getElementById('ClassList')) { + listItems = document.getElementById('ClassList').getElementsByTagName('li') + filterList(listItems, search) + } + if (document.getElementById('ClassList2')) { + listItems = document.getElementById('ClassList2').getElementsByTagName('li') + filterList(listItems, search) + } + if (document.getElementById('FileList')) { + listItems = document.getElementById('FileList').getElementsByTagName('li') + filterList(listItems, search) + } + if (document.getElementById('MethodsListInherited')) { + var links = document.getElementById('MethodsListInherited').getElementsByTagName('a') + var linksSelected = new Array() + for (var i=0; i < links.length; i++) { + if (links[i].parentNode.parentNode.tagName == "DD") { + linksSelected.push(links[i]) + } + } + filterList(linksSelected, search) + } + if (document.getElementById('MethodsList')) { + listItems = document.getElementById('MethodsList').getElementsByTagName('tbody')[0].getElementsByTagName('tr') + filterList(listItems, search, document.getElementById('MethodDetail').getElementsByTagName('li')) + } + } + + function filterList(listItems, search, relatedElements) { + var itemContent = "" + for (var i=0; i < listItems.length; i++) { + itemContent = listItems[i].textContent||listItems[i].innerText + if (itemContent != undefined) { + itemContent = itemContent.toLowerCase() + itemContent = itemContent.replace(/\s/g, "") + if (itemContent.indexOf(search) >= 0 || itemContent == "") { + listItems[i].style.display = "" + } else { + listItems[i].style.display = "none" + } + if (relatedElements != null) { + filterRelatedList(listItems[i], search, relatedElements) + } + } + } + } + + function filterRelatedList(listItem, search, relatedElements) { + var itemIndex = parseInt(listItem.className.replace('item', '')) + if (itemIndex <= relatedElements.length) { + if (relatedElements[itemIndex].className == "item"+ itemIndex) { + relatedElements[itemIndex].style.display = listItem.style.display + } + } + } + + + + + + /* Start public */ + return { + Init: function() { + wbos.Events.AddEvent( + document.getElementById('ClassFilter'), + onkeyup_ClassFilter, + "onkeyup" + ) + } + } + /* End public */ +})(); diff --git a/docs/javascript/html5.js b/docs/javascript/html5.js new file mode 100644 index 0000000..3587bf7 --- /dev/null +++ b/docs/javascript/html5.js @@ -0,0 +1,6 @@ +// html5shiv MIT @rem remysharp.com/html5-enabling-script +// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector +/*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++ai";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")", +"gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l, +g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d1){ai++;target=t=a0}for(;source=arguments[ai];ai++){for(var prop in source){p=source[prop];if(prop.charAt(0)!="@"){if(p&&p.splice){var tp=t[prop];t[prop]=tp&&tp.splice?tp.concat(p):new Array().concat(p)}else{if(p&&typeof p=="object"){t[prop]=jProton.extend(t[prop]||{},p)}else{t[prop]=p}}}else{if(prop=="@init"){p.call(t)}else{if(prop=="@require"){for(var ext in p){var v=p[ext];o=t.extensions[ext]||null;if(!o){throw'A extensão "'+ext+'" deve estar instalada.'}else{if(o=0){this.removeClass(e,name)}else{this.addClass(e,name)}},css:function(e,name,val){if(e){if(val){e.style[name]=val}else{var type=typeof name;if(type=="object"){for(p in name){e.style[p]=name[p]}}else{return window.getComputedStyle?document.defaultView.getComputedStyle(e,null)[name]||e.style[name]:e.currentStyle?e.currentStyle[name]||e.style[name]:undefined}}}else{return undefined}}});set.extend({"@extension":{css:"0.3.0a"},hasClass:function(name){return this[0]?(" "+this[0].className+" ").indexOf(" "+name+" ")!=-1:undefined},addClass:function(name){for(var i=0,ei;ei=this[i];i++){element.addClass(ei,name)}return this},removeClass:function(name){for(var i=0,ei;ei=this[i];i++){element.removeClass(ei,name)}return this},toggleClass:function(name){for(var i=0,ei;ei=this[i];i++){element.toggleClass(ei,name)}return this},css:function(name,val){if(val){for(var i=0,ei;ei=this[i];i++){element.css(ei,name,val)}return this}else{return element.css(this[0],name)}}});jProton.event=function(){var _events=new Array();var addEventListener=typeof document.addEventListener!="undefined";var attachEvent=typeof document.attachEvent!="undefined";return{version:"jProton.event.0.3.9a",add:function(e,type,fn){_events.push({e:e,type:type,fn:fn});if(addEventListener){e.addEventListener(type,fn,false)}else{if(attachEvent){e["e"+type+fn]=fn;e[type+fn]=function(){e["e"+type+fn](window.event)};e.attachEvent("on"+type,e[type+fn])}}},remove:function(e,type,fn){var l,fs=fn.toString();for(var i=0,li;li=_events[i];i++){if(li.e==e&&li.type==type&&(li.fn==fn||li.fn.toString()==fs)){l=_events.splice(i,1)[0];break}}if(l){fn=l.fn;if(addEventListener){e.removeEventListener(type,fn,false)}else{if(attachEvent){e.detachEvent("on"+type,e[type+fn]);e[type+fn]=null;e["e"+type+fn]=null}}}},removeAll:function(){for(var i=0;li=_events[i];i++){this.remove(li.e,li.type,li.fn)}}}}();set.extend({"@extension":{event:"0.3.0a"},on:function(type,fn){return this.each(function(){jProton.event.add(this,type,fn)})},un:function(type,fn){return this.each(function(){jProton.event.remove(this,type,fn)})}});jProton.ajax=function(options){return this.ajax.request(options)};var ajax=jProton.ajax;jProton.extend(ajax,function(){var _requests=new Array();var _transport=null;var _callback=null;var _states=["Uninitialized","Loading","Loaded","Interactive","Complete"];var _sendRequest=function(){var t=_transport,r=_requests.shift(),data;t.open(r.type,r.url,r.async);t.setRequestHeader("X-Requested-With","XMLHttpRequest");if(data=jProton.serialize(r.data)){t.setRequestHeader("Content-Type",r.contentType)}t.onreadystatechange=function(){_onStateChange(r)};t.send(data)};var _onStateChange=function(options){var fn,o=options,t=_transport;var state=_getState(t);if(fn=o["on"+state]){fn(_getResponse(o),o)}if(state=="Complete"){var success=t.status==200,response=_getResponse(o);if(fn=o.onUpdate){fn(response,o)}if(fn=o["on"+(success?"Success":"Failure")]){fn(response,o)}t.onreadystatechange=jProton.emptyFn;if(_requests.length>0){setTimeout(_sendRequest,10)}}};var _getResponse=function(options){var t=_transport,type=options.dataType;if(t.status!=200){return t.statusText}else{if(type=="text"){return t.responseText}else{if(type=="html"){return t.responseText}else{if(type=="xml"){return t.responseXML}else{if(type=="json"){return eval("("+t.responseText+")")}}}}}};var _getState=function(){return _states[_transport.readyState]};return{"@extension":{ajax:"0.3.0a"},"@init":function(){_transport=null;try{_transport=new XMLHttpRequest()}catch(e){try{_transport=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{_transport=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}},request:function(options){var o=options||{};o.type=o.type&&o.type.toLowerCase()||"get";o.async=o.async||true;o.dataType=o.dataType||"text";o.contentType=o.contentType||"application/x-www-form-urlencoded";_requests.push(o);var s=_getState();if(s=="Uninitialized"||s=="Complete"){_sendRequest()}}}}());set.extend({"@require":{dom:"0.3"},"@extension":{ajax:"0.3.0a"},load:function(url,data,callback){var d=data||null,fn=callback||null;if((typeof data=="function")&&(typeof callback=="undefined")){d=null;fn=data}ajax.request({url:url,data:d,onSuccess:fn,elements:this,onUpdate:function(r,o){$(o.elements).html(r)}});return this}});jProton.extend({"@extension":{ajax:"0.2.0a"},serialize:function(data){var r=[""],rl=0;if(data){if(typeof data=="string"){r[rl++]=data}else{if(data.innerHTML&&data.elements){for(var i=0,el,l=(el=data.elements).length;i+~]\s?|\s|$)/,reTag=/^(#)?([\w-\*]+)/,reNth=/(\d*)n\+?(\d*)/,reNth2=/\D/,isIE=!!window.ActiveXObject,key=30803;eval("var batch = 30803;");function _quickId(e,mode,context,val){if(e==context){var d=context.ownerDocument||context;return d.getElementById(val)}e=_getNodes(e,mode,"*");return _byId(e,val)}var _byId=function(e,val){if(e.tagName||e==document){e=[e]}var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){if(ei&&ei.id==val){r[++rl]=ei;return r}}return r};var _byTag=function(e,val){if(e.tagName||e==document){e=[e]}var r=new Array(),rl=-1;val=val.toLowerCase();for(var i=0,ei;ei=e[i];i++){if(ei.nodeType==1&&ei.tagName.toLowerCase()==val){r[++rl]=ei}}return r};var _byClass=function(e,val){if(!val){return e}var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){if((" "+ei.className+" ").indexOf(val)!=-1){r[++rl]=ei}}return r};var _byAttr=function(e,attr,op,val){var r=new Array(),rl=-1,f=query.operators[op];for(var i=0,ei,a;ei=e[i];i++){if(attr=="class"||attr=="className"){a=ei.className}else{if(attr=="for"){a=ei.htmlFor}else{if(attr=="href"){a=ei.getAttribute("href",2)}else{a=ei.getAttribute(attr)}}}if((f&&f(a,val))||(!f&&a)){r[++rl]=ei}}return r};var _byPseudo=function(e,name,val){return query.pseudos[name](e,val)};var _getNodes=function(e,mode,name){var r=new Array(),rl=-1;if(!e){return r}name=name||"*";if(typeof e.getElementsByTagName!="undefined"){e=[e]}if(!mode){for(var i=0,ei,n;ei=e[i];i++){n=ei.getElementsByTagName(name);for(var j=0,nj;nj=n[j];j++){r[++rl]=nj}}}else{if(mode=="/"||mode==">"){var utag=name.toUpperCase();for(var i=0,ei,n;ei=e[i];i++){n=ei.children||ei.childNodes;for(var j=0,nj;nj=n[j];j++){if(nj.nodeName==utag||nj.nodeName==name||name=="*"){r[++rl]=nj}}}}else{if(mode=="+"){var utag=name.toUpperCase();for(var i=0,ei;ei=e[i];i++){while((ei=ei.nextSibling)&&ei.nodeType!=1){}if(ei&&(ei.nodeName==utag||ei.nodeName==name||name=="*")){r[++rl]=ei}}}else{if(mode=="~"){for(var i=0,ei;ei=e[i];i++){while((ei=ei.nextSibling)&&(ei.nodeType!=1||(name=="*"||ei.tagName.toLowerCase()!=name))){}if(ei){r[++rl]=ei}}}}}}return r};var _unique=function(e){if(!e){return new Array()}var len=e.length,i,r=e,ei;if(!len||typeof e.nodeType!="undefined"||len==1){return e}if(isIE&&typeof e[0].selectSingleNode!="undefined"){var d=++key;e[0].setAttribute("__unique",d);var r=[e[0]],rl=0;for(var i=1,ei;ei=e[i];i++){if(!ei.getAttribute("__unique")!=d){ei.setAttribute("__unique",d);r[++rl]=ei}}for(var i=0;ei=e[i];i++){ei.removeAttribute("__unique")}return r}var d=++key;e[0].__unique=d;for(i=1,ei;ei=e[i];i++){if(ei.__unique!=d){ei.__unique=d}else{r=new Array(),rl=-1;for(var j=0;j1){return _unique(results)}return results},is:function(e,ss){if(typeof e=="string"){e=document.getElementById(e)}var isArray=!!e.splice,result=query.filter(isArray?e:[e],ss);return isArray?(result.length==e.length):(result.length>0)},filter:function(e,ss,nonMatches){ss=ss.replace(reTrim,"");if(!simpleCache[ss]){simpleCache[ss]=query.compile(ss,"simple")}var result=simpleCache[ss](e);return nonMatches?_diff(result,e):result},rules:[{re:/^\.([\w-]+)/,select:'e = _byClass(e, " {1} ");'},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:'e = _byPseudo(e, "{1}", "{2}");'},{re:/^\[([\w-]+)(?:(.?=)["']?(.+?)["']?)?\]/,select:'e = _byAttr(e, "{1}", "{2}", "{3}");'},{re:/^#([\w-]+)/,select:'e = _byId(e, "{1}");'}],operators:{"=":function(attr,val){return attr==val},"!=":function(attr,val){return attr!=val},"^=":function(attr,val){return attr&&attr.substr(0,val.length)==val},"$=":function(attr,val){return attr&&attr.substr(attr.length-val.length)==val},"*=":function(attr,val){return attr&&attr.indexOf(val)!==-1},"%=":function(attr,val){return(attr%val)==0},"|=":function(attr,val){return attr&&(attr==val||attr.substr(0,val.length+1)==val+"-")},"~=":function(attr,val){return attr&&(" "+attr+" ").indexOf(" "+val+" ")!=-1}},pseudos:{"first-child":function(e){var r=new Array(),rl=-1,n;for(var i=0,ei;ei=n=e[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[++rl]=ei}}return r},"last-child":function(e){var r=new Array(),rl=-1,n;for(var i=0,ei;ei=n=e[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[++rl]=ei}}return r},"nth-child":function(e,val){var r=new Array(),rl=-1,m=reNth.exec(val=="even"&&"2n"||val=="odd"&&"2n+1"||!reNth2.test(val)&&"n+"+val||val),f=(m[1]||1)-0,l=m[2]-0;for(var i=0,ei;ei=e[i];i++){var p=ei.parentNode;if(batch!=p._batch){var j=0;for(var n=p.firstChild;n;n=n.nextSibling){if(n.nodeType==1){n.nodeIndex=++j}}p._batch=batch}if(f==1){if(l==0||ei.nodeIndex==l){r[++rl]=ei}}else{if((ei.nodeIndex+l)%f==0){r[++rl]=ei}}}return r},"only-child":function(e){var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){if(!_prev(ei)&&!_next(ei)){r[++rl]=ei}}return r},empty:function(e){var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){var n=ei.childNodes,j=-1,nj,empty=true;while(nj=n[++j]){if(nj.nodeType==1||nj.nodeType==3){empty=false;break}}if(empty){r[++rl]=ei}}return r},contains:function(e,val){var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){if((ei.textContent||ei.innerText||"").indexOf(val)!=-1){r[++rl]=ei}}return r},nodeValue:function(e,val){var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){if(ei.firstChild&&ei.firstChild.nodeValue==val){r[++rl]=ei}}return r},checked:function(e){var r=new Array(),rl=-1;for(var i=0,ei;ei=e[i];i++){if(ei.checked==true){r[++rl]=ei}}return r},not:function(e,val){return query.filter(e,val,true)},any:function(e,val){var r=new Array(),rl=-1,s,ss=val.split("|");for(var i=0,ei;ei=e[i];i++){for(var j=0;s=ss[j];j++){if(query.is(ei,s)){r[++rl]=ei;break}}}return r},odd:function(e){return this["nth-child"](e,"odd")},even:function(e){return this["nth-child"](e,"even")},nth:function(e,val){return e[val-1]||new Array()},first:function(e){return e[0]||new Array()},last:function(e){return e[e.length-1]||new Array()},has:function(e,val){var r=new Array(),rl=-1,s=query.select;for(var i=0,ei;ei=e[i];i++){if(s(val,ei).length>0){r[++rl]=ei}}return r},next:function(e,val){var r=new Array(),rl=-1,is=query.is;for(var i=0,ei;ei=e[i];i++){var n=_next(ei);if(n&&is(n,val)){r[++rl]=ei}}return r},prev:function(e,val){var r=new Array(),rl=-1,is=query.is;for(var i=0,ei;ei=e[i];i++){var n=_prev(ei);if(n&&is(n,val)){r[++rl]=ei}}return r}}}}();var query=jProton.query})(); \ No newline at end of file diff --git a/docs/sh.css b/docs/sh.css new file mode 100644 index 0000000..1132131 --- /dev/null +++ b/docs/sh.css @@ -0,0 +1,182 @@ +.dp-highlighter +{ + font-family: "Consolas", "Courier New", Courier, mono, serif; + background-color: #E7E5DC; + margin: 1.5em 0 !important; + padding: 1px; /* adds a little border on top when controls are hidden */ +} + +/* clear styles */ +.dp-highlighter ol, +.dp-highlighter ol li, +.dp-highlighter ol li span +{ + line-height: 1.25em; + margin: 0; + padding: 0; + border: none; +} + +.dp-highlighter a, +.dp-highlighter a:hover +{ + background: none; + border: none; + padding: 0; + margin: 0; +} + +.dp-highlighter .bar +{ + padding-left: 45px; +} + +.dp-highlighter.collapsed .bar, +.dp-highlighter.nogutter .bar +{ + padding-left: 0px; +} + +.dp-highlighter ol +{ + list-style: decimal; /* for ie */ + background-color: #fff; + margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */ + padding: 0px; + color: #5C5C5C; +} + +.dp-highlighter.nogutter ol, +.dp-highlighter.nogutter ol li +{ + list-style: none !important; + margin-left: 0px !important; +} + +.dp-highlighter ol li, +.dp-highlighter .columns div +{ + list-style: decimal-leading-zero; /* better look for others, override cascade from OL */ + list-style-position: outside !important; + border-left: 3px solid #6CE26C; + background-color: #fafafa; + color: #5C5C5C; + padding: 0 3px 0 10px !important; + margin: 0 !important; +} + +.dp-highlighter.nogutter ol li, +.dp-highlighter.nogutter .columns div +{ + border: 0; +} + +.dp-highlighter .columns +{ + background-color: #fafafa; + color: gray; + overflow: hidden; + width: 100%; +} + +.dp-highlighter .columns div +{ + padding-bottom: 5px; +} + +.dp-highlighter ol li.alt +{ + background-color: #FFF; + color: inherit; +} + +.dp-highlighter ol li span +{ + color: black; + background-color: inherit; +} + +/* Adjust some properties when collapsed */ + +.dp-highlighter.collapsed ol +{ + margin: 0px; +} + +.dp-highlighter.collapsed ol li +{ + display: none; +} + +/* Additional modifications when in print-view */ + +.dp-highlighter.printing +{ + border: none; +} + +.dp-highlighter.printing .tools +{ + display: none !important; +} + +.dp-highlighter.printing li +{ + display: list-item !important; +} + +/* Styles for the tools */ + +.dp-highlighter .tools +{ + padding: 3px 8px 3px 10px; + font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; + color: silver; + background-color: #f8f8f8; + padding-bottom: 10px; + border-left: 3px solid #6CE26C; +} + +.dp-highlighter.nogutter .tools +{ + border-left: 0; +} + +.dp-highlighter.collapsed .tools +{ + border-bottom: 0; +} + +.dp-highlighter .tools a +{ + font-size: 9px; + color: #a0a0a0; + background-color: inherit; + text-decoration: none; + margin-right: 10px; +} + +.dp-highlighter .tools a:hover +{ + color: red; + background-color: inherit; + text-decoration: underline; +} + +/* About dialog styles */ + +.dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; } +.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; } +.dp-about td { padding: 10px; vertical-align: top; } +.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; } +.dp-about .title { color: red; background-color: inherit; font-weight: bold; } +.dp-about .para { margin: 0 0 4px 0; } +.dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; } +.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; } + +/* Language specific styles */ + +.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; } +.dp-highlighter .string { color: #00d; background-color: inherit; } +.dp-highlighter .keyword { color: #6277AA; font-weight: bold; background-color: inherit; } +.dp-highlighter .preprocessor { color: gray; background-color: inherit; } diff --git a/docs/sh.js b/docs/sh.js new file mode 100644 index 0000000..d322250 --- /dev/null +++ b/docs/sh.js @@ -0,0 +1 @@ +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('6 7={8:{16:{},1b:{},1i:{},1e:{},2L:{2G:\'<2y><1W><1S>2k...<1x 18="7-2U"><2S 4g="0"><1E><1C 18="21">

7.2q1T: {V}

36://30.2V.2K/2M

&21;41-3W 3V 3T.<1E><1C 18="3Q"><3N 1J="3E" 18="1p" 1m="3y" 3x="19.1p()"/>\'},1A:e,1T:"1.5.1"}};7.2q=7.8;7.8.16.1K={3m:{1h:"+ 3h 2h",1F:d(A){h A.1t},1j:d(B,A){B.26.2Q(B);A.i.q=A.i.q.l("2a","")}},4m:{1h:"4j 4e",1j:d(B,A){6 D=7.8.1b.1L(A.28).l(/\'+D+"");C.m.1p()}},3D:{1h:"21 3C 1V",1F:d(){h 19.1O!=e||7.8.1A!=e},1j:d(B,A){6 D=7.8.1b.1L(A.28).l(/&1H;/g,"<").l(/&2n;/g,">").l(/&3w;/g,"&");9(19.1O){19.1O.3v("1R",D)}14{9(7.8.1A!=e){6 C=A.2l;9(C==e){C=m.1n("i");A.2l=C;A.i.k(C)}C.y=\'<2r 3r="\'+7.8.1A+\'" 3p="1V=\'+3o(D)+\'" 1v="0" 1w="0" 1J="3n/x-3k-3j">\'}}2v("3g 1a 3d 1D 3b 1V 3a")}},38:{1h:"2N",1j:d(B,A){6 C=m.1n("5c");6 D=e;C.1z.35="58:57;1v:2Z;1w:2Z;51:-2Y;4Z:-2Y;";m.1x.k(C);D=C.2d.m;7.8.1b.2c(D,19.m);D.1M(\'\'+A.i.y+"");D.1p();C.2d.2T();C.2d.2N();2v("4F...");m.1x.2Q(C)}},2k:{1h:"?",1j:d(A){6 B=19.2E("","24","4C,1v=4z,1w=2P,2x=0");6 C=B.m;7.8.1b.2c(C,19.m);C.1M(7.8.2L.2G.l("{V}",7.8.1T));C.1p();B.2T()}}};7.8.16.2O=d(B){6 D=m.1n("29");D.q="4q";j(6 A 1D 7.8.16.1K){6 C=7.8.16.1K[A];9(C.1F!=e&&!C.1F(B)){15}D.y+=\'"+C.1h+""}h D};7.8.16.2R=d(A,B){6 C=B;1u(C!=e&&C.q.1P("7-1r")==-1){C=C.26}9(C!=e){7.8.16.1K[A].1j(B,C.1r)}};7.8.1b.2c=d(A,D){6 B=D.27("25");j(6 C=0;C\')}}};7.8.1b.1L=d(A){h(7.8.2F==12)?A.l(/<1k\\s*\\/?>|&1H;1k\\s*\\/?&2n;/1I,"\\n"):A};7.8.1i={2D:o 17("/\\\\*[\\\\s\\\\S]*?\\\\*/","1l"),2C:o 17("//.*$","1l"),3R:o 17("#.*$","1l"),2A:o 17(\'"(?:\\\\.|(\\\\\\\\\\\\")|[^\\\\""\\\\n])*"\',"g"),2z:o 17("\'(?:\\\\.|(\\\\\\\\\\\\\')|[^\\\\\'\'\\\\n])*\'","g")};7.8.2W=d(C,A,B){3.1m=C;3.v=A;3.f=C.f;3.11=B};7.8.r=d(){3.22=1f;3.2g=12;3.1t=1f;3.2w=12;3.3L=3H;3.2f=12};7.8.r.2u=d(B,A){9(B.vA.v){h 1}14{9(B.fA.f){h 1}}}}h 0};7.8.r.13.z=d(B){6 A=m.1n(B);A.1r=3;h A};7.8.r.13.2t=d(D,C){6 B=0;6 A=e;1u((A=D.1Y(3.1a))!=e){3.u[3.u.f]=o 7.8.2W(A[0],A.v,C)}};7.8.r.13.1q=d(E,C){9(E==e||E.f==0){h}6 D=3.z("1X");E=E.l(/ /g,"&1B;");E=E.l(/");9(C!=e){9((/1k/1I).3A(E)){6 A=E.1s("&1B;<1k>");j(6 B=0;BC.v)&&(A.v/1I,"\\n");6 I=E.1s("\\n");9(3.2g==12){3.1d.k(7.8.16.2O(3))}9(3.2f){6 A=3.z("i");6 C=3.z("i");6 B=10;6 D=1;1u(D<=2P){9(D%B==0){A.y+=D;D+=(D+"").f}14{A.y+="&3t;";D++}}C.q="3s";C.k(A);3.1d.k(C)}j(6 D=0,H=3.1U;D0;J++){9(F(I[J]).f==0){15}6 M=L.1Y(I[J]);9(M!=e&&M.f>0){K=3G.3l(M[0].f,K)}}9(K>0){j(6 J=0;J + + + + + + JsDoc Reference - $_.dom + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ + + +
+ Framework jProton +
+ + + +
+ +

+ Namespace $_.dom +

+ + + +
+

+
+ +

Defined in: DOM.js.

+ + + + + + + + + + + + +
+
Method Summary
+
+ +
+ + addClass(string) + Adds a class to the element(s) specified by the current selector +
+ +
+ + removeClass(string) + Removes a class from the element(s) specified by the current selector +
+ +
+ + hide() + Hides the element(s) specified by the current selector +
+ +
+ + show(string) + Shows the element(s) specified by the current selector. +
+ +
+ + attr(string, string) + Sets attributes on element(s) specified by the current selector, or, if name is not specified, returns the value of the attribute of the element specified by the current selector. +
+ +
+
+ + + + + + + + + + + +
+
+ Method Detail +
+
+ + +
+ +
+ $_.dom.addClass(string) + +
+
+ Adds a class to the element(s) specified by the current +selector + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + string + + class +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.dom.removeClass(string) + +
+
+ Removes a class from the element(s) specified by the current +selector + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + string + + class +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.dom.hide() + +
+
+ Hides the element(s) specified by the current selector + + + + +

+										
+									
+ + + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.dom.show(string) + +
+
+ Shows the element(s) specified by the current selector. +if type is specified, the element will have it's style +property set to "display:[your type]". If type is not +specified, the element is set to "display:block". + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + string?, Default: + + type +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.dom.attr(string, string) + : string +
+
+ Sets attributes on element(s) specified by the current +selector, or, if name is not specified, returns the +value of the attribute of the element specified by the +current selector. + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + name +
+ + + string + + value +
+ + + + + +
Returns:
+ + + + + + + +
+ + + string +
+ + + + +
+ +
+
+ + +
+ + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+ +
+
+ + + diff --git a/docs/symbols/$_.event.html b/docs/symbols/$_.event.html new file mode 100644 index 0000000..b1e6f71 --- /dev/null +++ b/docs/symbols/$_.event.html @@ -0,0 +1,461 @@ + + + + + + + JsDoc Reference - $_.event + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ + + +
+ Framework jProton +
+ + + +
+ +

+ Namespace $_.event +

+ + + +
+

+
+ +

Defined in: event.js.

+ + + + + + + + + + + + +
+
Method Summary
+
+ +
+ + add(string, function) + Adds an event that returns a callback when triggered on the selected event and selector +
+ +
+ + remove(string, string) + Removes an event bound the the specified selector, event type, and callback +
+ +
+ + live(string, string, function) + Binds a persistent, delegated event +
+ +
+ + delegate(string, string) + Binds an event to a parent object +
+ +
+
+ + + + + + + + + + + +
+
+ Method Detail +
+
+ + +
+ +
+ $_.event.add(string, function) + +
+
+ Adds an event that returns a callback when triggered on the selected +event and selector + + + + +
Eg. $_("#selector").event.add("click", do_something());
+ +
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + event +
+ + + function + + callback +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.event.remove(string, string) + +
+
+ Removes an event bound the the specified selector, event type, and callback + + + + +
Eg. $_("#selector").event.remove("click", do_something());
+ +
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + event +
+ + + string + + callback +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.event.live(string, string, function) + +
+
+ Binds a persistent, delegated event + + + + +
Eg. $_.event.live(".button", "click", do_something());
+ +
+ + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + +
+ + + string + + target +
+ + + string + + event +
+ + + function + + callback +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.event.delegate(string, string) + +
+
+ Binds an event to a parent object + + + + +
Eg. $_("#parent").delegate(".button", "click", do_something());
+ +
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + target +
+ + + string + + event_type +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ +
+
+ + +
+ + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+ +
+
+ + + diff --git a/docs/symbols/$_.html b/docs/symbols/$_.html new file mode 100644 index 0000000..c1f2b20 --- /dev/null +++ b/docs/symbols/$_.html @@ -0,0 +1,775 @@ + + + + + + + JsDoc Reference - $_ + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ + + +
+ Framework jProton +
+ + + +
+ +

+ Namespace $_ +

+ + + +
+

+
+ +

Defined in: core.js.

+ + + + + + + + + +
+
Field Summary
+
+ +
+ + dom + DOM Dom manipulation module +
+ +
+ + store + Wrapper for localstorage data serialization +
+ +
+ + util + String and object manipulation utilities +
+ +
+ + event + +
+ +
+
+ + + + + + + +
+
Method Summary
+
+ +
+ + $(string, string) + $ Simple DOM selector function +
+ +
+ + ext(string, object) + Adds the property `obj` to the $_ object, calling it `name` +
+ +
+ + each(function) + Iterates over a $_ object, applying a callback to each item +
+ +
+ + type(mixed) + Retrieves the type of the passed variable +
+ +
+ + get(string, object, function) + Sends a GET type ajax request +
+ +
+ + post(string, object, function) + Sends a POST type ajax request +
+ +
+
+ + + + + + + + +
+
+ Field Detail +
+
+ +
+ +
+ $_.dom + +
+ +
+ DOM + +Dom manipulation module + +

Defined in: DOM.js.

+ + +
+ + +

+									
+								
+									
+										
+										
+										
+										
+				
+								
+ +
+ +
+ $_.store + +
+ +
+ Wrapper for localstorage data serialization + +

Defined in: store.js.

+ + +
+ + +

+									
+								
+									
+										
+										
+										
+										
+				
+								
+ +
+ +
+ $_.util + +
+ +
+ String and object manipulation utilities + +

Defined in: util.js.

+ + +
+ + +

+									
+								
+									
+										
+										
+										
+										
+				
+								
+ +
+ +
+ $_.event + +
+ +
+ + +

Defined in: event.js.

+ + +
+ + +

+									
+								
+									
+										
+										
+										
+										
+				
+								
+ +
+
+ + + + +
+
+ Method Detail +
+
+ + +
+ +
+ $_.$(string, string) + : object +
+
+ $ + +Simple DOM selector function + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + selector +
+ + + string + + context +
+ + + + + +
Returns:
+ + + + + + + +
+ + + object +
+ + + + +
+ + +
+ +
+ $_.ext(string, object) + +
+
+ Adds the property `obj` to the $_ object, calling it `name` + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + name +
+ + + object + + obj +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.each(function) + +
+
+ Iterates over a $_ object, applying a callback to each item + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + function + + callback +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.type(mixed) + : string +
+
+ Retrieves the type of the passed variable + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + mixed + + obj +
+ + + + + +
Returns:
+ + + + + + + +
+ + + string +
+ + + + +
+ + +
+ +
+ $_.get(string, object, function) + +
+
+ Sends a GET type ajax request + +

Defined in: ajax.js.

+ + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + +
+ + + string + + url +
+ + + object + + data +
+ + + function + + callback +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.post(string, object, function) + +
+
+ Sends a POST type ajax request + +

Defined in: ajax.js.

+ + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + +
+ + + string + + url +
+ + + object + + data +
+ + + function + + callback +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ +
+
+ + +
+ + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:50:02 GMT-0400 (EDT) +
+ +
+
+ + + diff --git a/docs/symbols/$_.store.html b/docs/symbols/$_.store.html new file mode 100644 index 0000000..b7cc2f9 --- /dev/null +++ b/docs/symbols/$_.store.html @@ -0,0 +1,348 @@ + + + + + + + JsDoc Reference - $_.store + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ + + +
+ Framework jProton +
+ + + +
+ +

+ Namespace $_.store +

+ + + +
+

+
+ +

Defined in: store.js.

+ + + + + + + + + + + + +
+
Method Summary
+
+ +
+ + get(string) + Retrieves and deserializes a value from localstorage, based on the specified key +
+ +
+ + set(string, mixed) + Puts a value into localstorage at the specified key, and JSON-encodes the value if not a string +
+ +
+ + remove(string) + Removes the specified item from localstorage +
+ +
+
+ + + + + + + + + + + +
+
+ Method Detail +
+
+ + +
+ +
+ $_.store.get(string) + +
+
+ Retrieves and deserializes a value from localstorage, +based on the specified key + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + string + + key +
+ + + + + +
Returns:
+ + + + + + + +
+ + + object +
+ + + + +
+ + +
+ +
+ $_.store.set(string, mixed) + +
+
+ Puts a value into localstorage at the specified key, +and JSON-encodes the value if not a string + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + key +
+ + + mixed + + value +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ + +
+ +
+ $_.store.remove(string) + +
+
+ Removes the specified item from localstorage + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + string + + key +
+ + + + + +
Returns:
+ + + + + + + +
+ + + void +
+ + + + +
+ +
+
+ + +
+ + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+ +
+
+ + + diff --git a/docs/symbols/$_.util.html b/docs/symbols/$_.util.html new file mode 100644 index 0000000..de2de00 --- /dev/null +++ b/docs/symbols/$_.util.html @@ -0,0 +1,668 @@ + + + + + + + JsDoc Reference - $_.util + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ + + +
+ Framework jProton +
+ + + +
+ +

+ Namespace $_.util +

+ + + +
+

+
+ +

Defined in: util.js.

+ + + + + + + + + + + + +
+
Method Summary
+
+ +
+ + text(string) + Sets or retrieves the text content of the element specified by the current selector. +
+ +
+ + css(string, string) + Sets or retrieves a css property of the element specified by the current selector. +
+ +
+ + object_keys(object) + Retrieve the keys, or member names of an object +
+ +
+ + object_values(object) + Retrieves the values of an object, and returns them as an array +
+ +
+ + array_combine(array/object, array/object) + Creates an object, with the property names of the first array, and the values of the second. +
+ +
+ + object_merge(object) + Combines two or more objects/arrays. +
+ +
+ + str_trans(string, mixed, string) + Replaces sections of strings in a greedy fashion, starting with the longest replace pairs first. +
+ +
+
+ + + + + + + + + + + +
+
+ Method Detail +
+
+ + +
+ +
+ $_.util.text(string) + : string +
+
+ Sets or retrieves the text content of the element +specified by the current selector. If a value is +passed, it will set that value on the current element, +otherwise it will return the value of the current element + +

Defined in: DOM.js.

+ + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + string?, Default: + + value +
+ + + + + +
Returns:
+ + + + + + + +
+ + + string +
+ + + + +
+ + +
+ +
+ $_.util.css(string, string) + : string +
+
+ Sets or retrieves a css property of the element +specified by the current selector. If a value is +passed, it will set that value on the current element, +otherwise it will return the value of the css property +on the current element + +

Defined in: DOM.js.

+ + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + string + + property +
+ + + string?, Default: + + value +
+ + + + + +
Returns:
+ + + + + + + +
+ + + string +
+ + + + +
+ + +
+ +
+ $_.util.object_keys(object) + : array +
+
+ Retrieve the keys, or member names of an object + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + object + + +
+ + + + + +
Returns:
+ + + + + + + +
+ + + array +
+ + + + +
+ + +
+ +
+ $_.util.object_values(object) + : array +
+
+ Retrieves the values of an object, and returns +them as an array + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + object + + +
+ + + + + +
Returns:
+ + + + + + + +
+ + + array +
+ + + + +
+ + +
+ +
+ $_.util.array_combine(array/object, array/object) + : object +
+
+ Creates an object, with the property names of the first array, +and the values of the second. If objects are passed, the values +of the object are used. If the arrays or objects passed are +not the same size, the function will return false. + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + +
+ + + array/object + + keys +
+ + + array/object + + vals +
+ + + + + +
Returns:
+ + + + + + + +
+ + + object +
+ + + + +
+ + +
+ +
+ $_.util.object_merge(object) + : object +
+
+ Combines two or more objects/arrays. If the keys are numeric, the outputted +object will have re-indexed keys. If a key/value pair exists in both objects, +indentical values will be droped, but if a key exists with a different value, +with the same key, the value in the second array will replace the value in the +first + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + +
+ + + object + + [as many as you wish to combine] +
+ + + + + +
Returns:
+ + + + + + + +
+ + + object +
+ + + + +
+ + +
+ +
+ $_.util.str_trans(string, mixed, string) + : string +
+
+ Replaces sections of strings in a greedy fashion, +starting with the longest replace pairs first. Accepts +one replace pair as two parameters, or an object, with +from => to replacements as key/value pairs + + + + +

+										
+									
+ + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + +
+ + + string + + input_string +
+ + + mixed + + +
+ + + string?, Default: + + to +
+ + + + + +
Returns:
+ + + + + + + +
+ + + string +
+ + + + +
+ +
+
+ + +
+ + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+ +
+
+ + + diff --git a/docs/symbols/_global_.html b/docs/symbols/_global_.html new file mode 100644 index 0000000..a3528c5 --- /dev/null +++ b/docs/symbols/_global_.html @@ -0,0 +1,115 @@ + + + + + + + JsDoc Reference - _global_ + + + + + + + + + +
+
+ +
+
+
+
 
+
Project Outline
+
+ + +
+ +
+ +
+
+
 
$_.dom
addClass(string)
removeClass(string)
show(string)
attr(string, string)
+ +
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+ +
+
get(string)
set(string, mixed)
remove(string)
+ +
+
+
 
$_.util
text(string)
css(string, string)
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+ +
+
+ +
+
+
+ + +
+
«
+ + + +
+ Framework jProton +
+ + + +
+ +

+ Built-In Namespace _global_ +

+ + + +
+

+
+ + + + + + + + + + + + + + + + + + + + +
+ + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Nov 01 2011 18:52:39 GMT-0400 (EDT) +
+ +
+
+ + + diff --git a/docs/symbols/src/kis-js_src_core_core.js.html b/docs/symbols/src/kis-js_src_core_core.js.html new file mode 100755 index 0000000..48d4af8 --- /dev/null +++ b/docs/symbols/src/kis-js_src_core_core.js.html @@ -0,0 +1,236 @@ +
  1 /**
+  2 	Kis JS		Keep It Simple JS Library
+  3 	Copyright	Timothy J. Warren
+  4 	License		Public Domain
+  5 	Version		0.5.0-pre
+  6  */
+  7 (function (){
+  8 
+  9 	"use strict";
+ 10 
+ 11 	//Browser requirements check
+ 12 	if (!document.querySelectorAll)
+ 13 	{
+ 14 		return;
+ 15 	}
+ 16 
+ 17 	var $_, $, dcopy, sel, sel_string;
+ 18 	
+ 19 
+ 20 	/**
+ 21 	 * $_
+ 22 	 *
+ 23 	 * Constructor function
+ 24 	 *
+ 25 	 * @constuctor
+ 26 	 * @namespace
+ 27 	 * @param string selector
+ 28 	 * @return object
+ 29 	 */
+ 30 	$_ = function(s)
+ 31 	{
+ 32 		//Have documentElement be default selector, just in case
+ 33 		if(typeof s === "undefined")
+ 34 		{
+ 35 			//Defines a "global" selector for that instance
+ 36 			sel = (typeof $_.el !== "undefined") 
+ 37 				? $_.el
+ 38 				: document.documentElement;
+ 39 		}
+ 40 		else
+ 41 		{
+ 42 			sel = (typeof s !== "object") ? $(s) : s;
+ 43 		}
+ 44 		
+ 45 		// Add the selector to the prototype
+ 46 		$_.prototype.el = sel;
+ 47 
+ 48 		// Make a copy before adding properties
+ 49 		var self = dcopy($_);
+ 50 
+ 51 		// Give sel to each extension.
+ 52 		for(var i in self) 
+ 53 		{
+ 54 			if(typeof self[i] === "object")
+ 55 			{
+ 56 				self[i].el = sel;
+ 57 			}	
+ 58 		}
+ 59 
+ 60 		self.el = sel;
+ 61 	
+ 62 		return self;
+ 63 	};
+ 64 	
+ 65 	/**
+ 66 	 * $
+ 67 	 *
+ 68 	 * Simple DOM selector function
+ 69 	 *
+ 70 	 * @memberOf $_
+ 71 	 * @param string selector
+ 72 	 * @param string context
+ 73 	 * @return object
+ 74 	 * @type object
+ 75 	 */
+ 76 	$ = function (a, context)
+ 77 	{
+ 78 		var x, c;
+ 79 		
+ 80 		if (typeof a != "string" || typeof a === "undefined"){ return a;}
+ 81 		
+ 82 		//Check for a context of a specific element, otherwise, just run on the document
+ 83 		c  = (context != null && context.nodeType === 1) 
+ 84 			? context 
+ 85 			: document;
+ 86 		
+ 87 		//Pick the quickest method for each kind of selector
+ 88 		if (a.match(/^#([\w\-]+$)/))
+ 89 		{
+ 90 			return document.getElementById(a.split('#')[1]);
+ 91 		}
+ 92 		else
+ 93 		{
+ 94 			x = c.querySelectorAll(a);
+ 95 		}
+ 96 		
+ 97 		//Return the single object if applicable
+ 98 		return (x.length === 1) ? x[0] : x;
+ 99 	};
+100 	
+101 	/**
+102 	 * Deep copy/prototypical constructor function
+103 	 *
+104 	 * @param object obj
+105 	 * @private
+106 	 * @return object
+107 	 * @type object
+108 	 */
+109 	dcopy = function(obj)
+110 	{
+111 		var type, F;
+112 		
+113 		if(typeof obj === "undefined")
+114 		{
+115 			return;
+116 		}
+117 		
+118 		if(typeof Object.create !== "undefined")
+119 		{
+120 			return Object.create(obj);
+121 		}
+122 		
+123 		type = typeof obj;
+124 		
+125 		if(type !== "object" && type !== "function")
+126 		{
+127 			return;
+128 		}
+129 		
+130 		/**
+131 		 * @private
+132 		 */
+133 		F = function(){};
+134 		
+135 		F.prototype = obj;
+136 		
+137 		return new F();
+138 		
+139 	};
+140 	
+141 	/**
+142 	 * Adds the property `obj` to the $_ object, calling it `name`
+143 	 * 
+144 	 * @param string name
+145 	 * @param object obj
+146 	 * @return void
+147 	 */
+148 	$_.ext = function(name, obj)
+149 	{
+150 		obj.el = sel;
+151 		$_[name] = obj;
+152 	};
+153 	
+154 	/**
+155 	 * Iterates over a $_ object, applying a callback to each item
+156 	 *
+157 	 * @name $_.each
+158 	 * @function
+159 	 * @param function callback
+160 	 * @return void
+161 	 */
+162 	$_.ext('each', function (callback)
+163 	{
+164 		if(typeof sel.length !== "undefined" && sel !== window)
+165 		{
+166 			var len = sel.length;
+167 
+168 			if (len === 0)
+169 			{
+170 				return;
+171 			}
+172 
+173 			var selx;
+174 			for (var x = 0; x < len; x++)
+175 			{
+176 				selx = (sel.item(x)) ? sel.item(x) : sel[x];
+177 				callback(selx);
+178 			}
+179 		}
+180 		else
+181 		{
+182 			callback(sel);
+183 		}
+184 	});
+185 	
+186 	/**
+187 	 * Retrieves the type of the passed variable
+188 	 *
+189 	 * @param mixed obj
+190 	 * @return string
+191 	 * @type string
+192 	 */
+193 	$_.type = function(obj) 
+194 	{
+195 		if((function() {return obj && (obj !== this)}).call(obj))
+196 		{
+197 			//fallback on 'typeof' for truthy primitive values
+198 			return (typeof obj).toLowerCase();
+199 		}
+200 		
+201 		return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
+202 	};
+203 
+204 	//Set global variables
+205 	$_ = window.$_ = window.$_ || $_;
+206 	$_.$ = $;
+207 	
+208 	//console.log polyfill
+209 	if(typeof window.console === "undefined")
+210 	{
+211 		window.console = {
+212 			log:function(){}
+213 		};
+214 	}
+215 	
+216 	/**
+217 	 * String trim function polyfill
+218 	 */
+219 	if(typeof String.prototype.trim === "undefined")
+220 	{
+221 		/**
+222 		 * @private
+223 		 */
+224 		String.prototype.trim = function(){
+225 			return this.replace(/^\s+|\s+$/g, "");
+226 		};
+227 	}
+228 	
+229 }());
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_DOM.js.html b/docs/symbols/src/kis-js_src_modules_DOM.js.html new file mode 100755 index 0000000..43e8928 --- /dev/null +++ b/docs/symbols/src/kis-js_src_modules_DOM.js.html @@ -0,0 +1,485 @@ +
  1 /*
+  2  * classList.js: Cross-browser full element.classList implementation.
+  3  * 2011-06-15
+  4  *
+  5  * By Eli Grey, http://eligrey.com
+  6  * Public Domain.
+  7  * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+  8  */
+  9 
+ 10 if (typeof document !== "undefined" && !("classList" in document.createElement("a")))
+ 11 {
+ 12 	(function (view){
+ 13 	
+ 14 		var classListProp = "classList",
+ 15 			protoProp = "prototype",
+ 16 			elemCtrProto = (view.HTMLElement || view.Element)[protoProp],
+ 17 			objCtr = Object,
+ 18 			strTrim = String[protoProp].trim ||
+ 19 			function ()
+ 20 			{
+ 21 				return this.replace(/^\s+|\s+$/g, "");
+ 22 			},
+ 23 			arrIndexOf = Array[protoProp].indexOf ||
+ 24 			function (item)
+ 25 			{
+ 26 				var
+ 27 				i = 0,
+ 28 					len = this.length;
+ 29 				for (; i < len; i++)
+ 30 				{
+ 31 					if (i in this && this[i] === item)
+ 32 					{
+ 33 						return i;
+ 34 					}
+ 35 				}
+ 36 				return -1;
+ 37 			}
+ 38 			// Vendors: please allow content code to instantiate DOMExceptions
+ 39 			,
+ 40 			/**
+ 41 			 * @private
+ 42 			 */
+ 43 			DOMEx = function (type, message)
+ 44 			{
+ 45 				this.name = type;
+ 46 				this.code = DOMException[type];
+ 47 				this.message = message;
+ 48 			},
+ 49 			/**
+ 50 			 * @private
+ 51 			 */
+ 52 			checkTokenAndGetIndex = function (classList, token)
+ 53 			{
+ 54 				if (token === "")
+ 55 				{
+ 56 					throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified");
+ 57 				}
+ 58 				if (/\s/.test(token))
+ 59 				{
+ 60 					throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character");
+ 61 				}
+ 62 				return arrIndexOf.call(classList, token);
+ 63 			},
+ 64 			/**
+ 65 			 * @private
+ 66 			 */
+ 67 			ClassList = function (elem)
+ 68 			{
+ 69 				var
+ 70 				trimmedClasses = strTrim.call(elem.className),
+ 71 					classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [],
+ 72 					i = 0,
+ 73 					len = classes.length;
+ 74 				for (; i < len; i++)
+ 75 				{
+ 76 					this.push(classes[i]);
+ 77 				}
+ 78 				this._updateClassName = function ()
+ 79 				{
+ 80 					elem.className = this.toString();
+ 81 				};
+ 82 			},
+ 83 			classListProto = ClassList[protoProp] = [],
+ 84 			/**
+ 85 			 * @private
+ 86 			 */
+ 87 			classListGetter = function ()
+ 88 			{
+ 89 				return new ClassList(this);
+ 90 			};
+ 91 		// Most DOMException implementations don't allow calling DOMException's toString()
+ 92 		// on non-DOMExceptions. Error's toString() is sufficient here.
+ 93 		DOMEx[protoProp] = Error[protoProp];
+ 94 		classListProto.item = function (i)
+ 95 		{
+ 96 			return this[i] || null;
+ 97 		};
+ 98 		classListProto.contains = function (token)
+ 99 		{
+100 			token += "";
+101 			return checkTokenAndGetIndex(this, token) !== -1;
+102 		};
+103 		classListProto.add = function (token)
+104 		{
+105 			token += "";
+106 			if (checkTokenAndGetIndex(this, token) === -1)
+107 			{
+108 				this.push(token);
+109 				this._updateClassName();
+110 			}
+111 		};
+112 		classListProto.remove = function (token)
+113 		{
+114 			token += "";
+115 			var index = checkTokenAndGetIndex(this, token);
+116 			if (index !== -1)
+117 			{
+118 				this.splice(index, 1);
+119 				this._updateClassName();
+120 			}
+121 		};
+122 		classListProto.toggle = function (token)
+123 		{
+124 			token += "";
+125 			if (checkTokenAndGetIndex(this, token) === -1)
+126 			{
+127 				this.add(token);
+128 			}
+129 			else
+130 			{
+131 				this.remove(token);
+132 			}
+133 		};
+134 		classListProto.toString = function ()
+135 		{
+136 			return this.join(" ");
+137 		};
+138 
+139 		if (objCtr.defineProperty)
+140 		{
+141 			var classListPropDesc = {
+142 				get: classListGetter,
+143 				enumerable: true,
+144 				configurable: true
+145 			};
+146 			try
+147 			{
+148 				objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
+149 			}
+150 			catch (ex)
+151 			{ // IE 8 doesn't support enumerable:true
+152 				if (ex.number === -0x7FF5EC54)
+153 				{
+154 					classListPropDesc.enumerable = false;
+155 					objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
+156 				}
+157 			}
+158 		}
+159 		else if (objCtr[protoProp].__defineGetter__)
+160 		{
+161 			elemCtrProto.__defineGetter__(classListProp, classListGetter);
+162 		}
+163 
+164 	}(self));
+165 }
+166 
+167 // --------------------------------------------------------------------------
+168 
+169 (function (){
+170 	var d, tag_reg, class_reg;
+171 	
+172 	tag_reg = /^([\w\-]+)$/;
+173 	class_reg = /\.([\w\-]+)$/;
+174 	
+175 	
+176 	//Private function for getting/setting attributes
+177 	function _attr(sel, name, value)
+178 	{
+179 		var oldVal, doAttr;
+180 
+181 		//Get the value of the attribute, if it exists
+182 		if (typeof sel.hasAttribute !== "undefined")
+183 		{
+184 			if (sel.hasAttribute(name))
+185 			{
+186 				oldVal = sel.getAttribute(name);
+187 			}
+188 
+189 			doAttr = true;
+190 		}
+191 		else if (typeof sel[name] !== "undefined")
+192 		{
+193 			oldVal = sel[name];
+194 			doAttr = false;
+195 		}
+196 		else if (name === "class" && typeof sel.className !== "undefined") //className attribute
+197 		{
+198 			name = "className";
+199 			oldVal = sel.className;
+200 			doAttr = false;
+201 		}
+202 
+203 		//Well, I guess that attribute doesn't exist
+204 		if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null))
+205 		{
+206 			console.log(value);
+207 			console.log(sel);
+208 			console.log("Element does not have the selected attribute");
+209 			return;
+210 		}
+211 
+212 		//No value to set? Return the current value
+213 		if (typeof value === "undefined")
+214 		{
+215 			return oldVal;
+216 		}
+217 
+218 		//Determine what to do with the attribute
+219 		if (typeof value !== "undefined" && value !== null)
+220 		{
+221 			if(doAttr === true)
+222 			{
+223 				sel.setAttribute(name, value);
+224 			}
+225 			else
+226 			{
+227 				sel[name] = value;
+228 			} 
+229 		}
+230 		else if (value === null)
+231 		{
+232 			if(doAttr === true)
+233 			{
+234 				sel.removeAttribute(name);
+235 			}
+236 			else
+237 			{
+238 				delete sel[name];
+239 			} 
+240 		}
+241 
+242 		return (typeof value !== "undefined") ? value : oldVal;
+243 	}
+244 	
+245 	function _toCamel(s)
+246 	{
+247 		return s.replace(/(\-[a-z])/g, function($1){
+248 			return $1.toUpperCase().replace('-','');
+249 		});
+250 	}
+251 
+252 	function _css(sel, prop, val)
+253 	{
+254 		var equi;
+255 		
+256 		//Camel-case
+257 		prop = _toCamel(prop);
+258 
+259 		//Equivalent properties for 'special' browsers
+260 		equi = {
+261 			outerHeight: "offsetHeight",
+262 			outerWidth: "offsetWidth",
+263 			top: "posTop"
+264 		};
+265 		
+266 		
+267 		//If you don't define a value, try returning the existing value
+268 		if(typeof val === "undefined" && sel.style[prop] !== "undefined")
+269 		{
+270 			return sel.style[prop];
+271 		}
+272 		else if(typeof val === "undefined" && sel.style[equi[prop]] !== "undefined")
+273 		{
+274 			return sel.style[equi[prop]];
+275 		}
+276 
+277 		//Let's try the easy way first
+278 		if(typeof sel.style[prop] !== "undefined")
+279 		{
+280 			sel.style[prop] = val;
+281 
+282 			//Short circuit
+283 			return;
+284 		}
+285 		else if(sel.style[equi[prop]])
+286 		{
+287 			sel.style[equi[prop]] = val;
+288 			return;
+289 		}
+290 		
+291 		//No matches? Well, lets log it for now
+292 		console.log("Property " + prop + " nor an equivalent seems to exist");
+293 	}
+294 	
+295 	// --------------------------------------------------------------------------
+296 
+297 	/**
+298 	 * DOM
+299 	 * 
+300 	 * Dom manipulation module
+301 	 * @namespace
+302 	 * @memberOf $_
+303 	 * @name dom
+304 	 */
+305 	d = {
+306 		/**
+307 		 * Adds a class to the element(s) specified by the current
+308 		 * selector
+309 		 * 
+310 		 * @name addClass
+311 		 * @memberOf $_.dom
+312 		 * @function
+313 		 * @param string class
+314 		 * @return void
+315 		 */
+316 		addClass: function (c)
+317 		{
+318 			$_.each(function (e){
+319 				e.classList.add(c);
+320 			});
+321 		},
+322 		/**
+323 		 * Removes a class from the element(s) specified by the current
+324 		 * selector
+325 		 * 
+326 		 * @name removeClass
+327 		 * @memberOf $_.dom
+328 		 * @function
+329 		 * @param string class
+330 		 * @return void
+331 		 */
+332 		removeClass: function (c)
+333 		{
+334 			$_.each(function (e){
+335 				e.classList.remove(c);
+336 			});
+337 		},
+338 		/**
+339 		 * Hides the element(s) specified by the current selector
+340 		 * 
+341 		 * @name hide
+342 		 * @memberOf $_.dom
+343 		 * @function
+344 		 * @return void
+345 		 */
+346 		hide: function ()
+347 		{
+348 			this.css('display', 'none');
+349 		},
+350 		/**
+351 		 * Shows the element(s) specified by the current selector. 
+352 		 * if type is specified, the element will have it's style
+353 		 * property set to "display:[your type]". If type is not
+354 		 * specified, the element is set to "display:block".
+355 		 * 
+356 		 * @name  show
+357 		 * @memberOf $_.dom
+358 		 * @function
+359 		 * @param [string] type
+360 		 * @return void
+361 		 */
+362 		show: function (type)
+363 		{
+364 			if (typeof type === "undefined")
+365 			{
+366 				type = "block";
+367 			}
+368 
+369 			this.css("display", type);
+370 		},
+371 		/**
+372 		 * Sets attributes on element(s) specified by the current 
+373 		 * selector, or, if name is not specified, returns the 
+374 		 * value of the attribute of the element specified by the
+375 		 * current selector.
+376 		 *
+377 		 * @name attr
+378 		 * @memberOf $_.dom
+379 		 * @function
+380 		 * @param string name
+381 		 * @param string value
+382 		 * @return string
+383 		 * @type string
+384 		 */
+385 		attr: function (name, value)
+386 		{
+387 			var sel = this.el;
+388 
+389 			//Make sure you don't try to get a bunch of elements
+390 			if (sel.length > 1 && typeof value === "undefined")
+391 			{
+392 				console.log(sel);
+393 				console.log("Must be a singular element");
+394 				return;
+395 			}
+396 			else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though
+397 			{
+398 				$_.each(function (e){
+399 					return _attr(e, name, value);
+400 				});
+401 			}
+402 			else //Normal behavior
+403 			{
+404 				return _attr(sel, name, value);
+405 			}
+406 		},
+407 		/**
+408 		 * Sets or retrieves the text content of the element
+409 		 * specified by the current selector. If a value is 
+410 		 * passed, it will set that value on the current element,
+411 		 * otherwise it will return the value of the current element
+412 		 *
+413 		 * @name text
+414 		 * @memberOf $_.util
+415 		 * @function
+416 		 * @param [string] value
+417 		 * @returns string
+418 		 * @type string
+419 		 */
+420 		text: function (value)
+421 		{
+422 			var oldValue, set, type, sel;
+423 		
+424 			sel = this.el;
+425 			
+426 			set = (typeof value !== "undefined") ? true : false;
+427 			
+428 			type = (typeof sel.innerText !== "undefined")
+429 				? "innerText"
+430 				: (typeof sel.textContent !== "undefined")
+431 					? "textContent"
+432 					: "innerHTML";
+433 
+434 			oldValue = sel[type];
+435 			
+436 			if(set)
+437 			{
+438 				sel[type] = value;
+439 				return value;
+440 			}
+441 			else
+442 			{
+443 				return oldValue;
+444 			}
+445 		},
+446 		/**
+447 		 * Sets or retrieves a css property of the element
+448 		 * specified by the current selector. If a value is 
+449 		 * passed, it will set that value on the current element,
+450 		 * otherwise it will return the value of the css property
+451 		 * on the current element
+452 		 *
+453 		 * @name css
+454 		 * @memberOf $_.util
+455 		 * @function
+456 		 * @param string property
+457 		 * @param [string] value
+458 		 * @returns string
+459 		 * @type string
+460 		 */
+461 		css: function (prop, val)
+462 		{
+463 			//Return the current value if a value is not set
+464 			if(typeof val === "undefined")
+465 			{
+466 				return _css(this.el, prop);
+467 			}
+468 		
+469 			$_.each(function (e){
+470 				_css(e, prop, val);
+471 			});
+472 		}
+473 	};
+474 
+475 	$_.ext('dom', d);
+476 	
+477 }());
+478 
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_ajax.js.html b/docs/symbols/src/kis-js_src_modules_ajax.js.html new file mode 100755 index 0000000..957a9d8 --- /dev/null +++ b/docs/symbols/src/kis-js_src_modules_ajax.js.html @@ -0,0 +1,110 @@ +
  1 /**
+  2  * Ajax
+  3  *
+  4  * Module for making ajax requests
+  5  */
+  6 (function (){
+  7 
+  8 	var ajax = {
+  9 		_do: function (url, data, callback, isPost)
+ 10 		{
+ 11 			if (typeof callback === "undefined")
+ 12 			{
+ 13 				/**
+ 14 				 * @private
+ 15 				 */
+ 16 				callback = function (){};
+ 17 			}
+ 18 
+ 19 			var request = (typeof window.XMLHttpRequest !== "undefined") 
+ 20 				? new XMLHttpRequest() 
+ 21 				: false;
+ 22 
+ 23 			var type = (isPost) ? "POST" : "GET";
+ 24 
+ 25 			url += (type === "GET") ? "?"+this._serialize(data) : '';
+ 26 			
+ 27 			request.open(type, url);
+ 28 
+ 29 			request.onreadystatechange = function ()
+ 30 			{
+ 31 				if (request.readyState === 4)
+ 32 				{
+ 33 					callback(request.responseText);
+ 34 				}
+ 35 			};
+ 36 
+ 37 			if (type === "POST")
+ 38 			{
+ 39 				request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ 40 				request.send(this._serialize(data));
+ 41 			}
+ 42 			else
+ 43 			{
+ 44 				request.send(null);
+ 45 			}
+ 46 		},
+ 47 		_serialize: function (data)
+ 48 		{
+ 49 			var pairs = [];
+ 50 
+ 51 			for (var name in data)
+ 52 			{
+ 53 				if (!data.hasOwnProperty(name))
+ 54 				{
+ 55 					continue;
+ 56 				}
+ 57 				if (typeof data[name] === "function")
+ 58 				{
+ 59 					continue;
+ 60 				}
+ 61 
+ 62 				var value = data[name].toString();
+ 63 
+ 64 				name = encodeURIComponent(name);
+ 65 				value = encodeURIComponent(value);
+ 66 
+ 67 				pairs.push(name + "=" + value);
+ 68 			}
+ 69 
+ 70 			return pairs.join("&");
+ 71 		}
+ 72 	};
+ 73 
+ 74 	/**
+ 75 	 * Sends a GET type ajax request
+ 76 	 * 
+ 77 	 * @name get
+ 78 	 * @function
+ 79 	 * @memberOf $_
+ 80 	 * @param string url
+ 81 	 * @param object data
+ 82 	 * @param function callback
+ 83 	 * @return void
+ 84 	 */
+ 85 	$_.ext('get', function (url, data, callback){
+ 86 		ajax._do(url, data, callback, false);
+ 87 	});
+ 88 	
+ 89 	/**
+ 90 	 * Sends a POST type ajax request
+ 91 	 * 
+ 92 	 * @name post
+ 93 	 * @function
+ 94 	 * @memberOf $_
+ 95 	 * @param string url
+ 96 	 * @param object data
+ 97 	 * @param function callback
+ 98 	 * @return void
+ 99 	 */
+100 	$_.ext('post', function (url, data, callback){
+101 		ajax._do(url, data, callback, true);
+102 	});
+103 }());
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_event.js.html b/docs/symbols/src/kis-js_src_modules_event.js.html new file mode 100755 index 0000000..bbbba2e --- /dev/null +++ b/docs/symbols/src/kis-js_src_modules_event.js.html @@ -0,0 +1,263 @@ +
  1 /**
+  2  * Event
+  3  *
+  4  * Event api wrapper
+  5  */
+  6 (function (){
+  7 
+  8 	"use strict";
+  9 
+ 10 	// Property name for expandos on DOM objects
+ 11 	var kis_expando = "KIS_0_5_0";
+ 12 
+ 13 	var _attach, _remove, _add_remove, e, _attach_delegate;
+ 14 
+ 15 	// Define the proper _attach and _remove functions
+ 16 	// based on browser support
+ 17 	if(typeof document.addEventListener !== "undefined")
+ 18 	{
+ 19 		/**
+ 20 		 * @private
+ 21 		 */
+ 22 		_attach = function (sel, event, callback)
+ 23 		{
+ 24 			if(typeof sel.addEventListener !== "undefined")
+ 25 			{
+ 26 				//Duplicated events are dropped, per the specification
+ 27 				sel.addEventListener(event, callback, false);
+ 28 			}
+ 29 		};
+ 30 		/**
+ 31 		 * @private
+ 32 		 */
+ 33 		_remove = function (sel, event, callback)
+ 34 		{
+ 35 			if(typeof sel.removeEventListener !== "undefined")
+ 36 			{
+ 37 				sel.removeEventListener(event, callback, false);
+ 38 			}
+ 39 		};
+ 40 	}
+ 41 	//typeof function doesn't work in IE where _attachEvent is available: brute force it
+ 42 	else if(typeof document.attachEvent !== "undefined") 
+ 43 	{
+ 44 		/**
+ 45 		 * @private
+ 46 		 */
+ 47 		_attach = function (sel, event, callback)
+ 48 		{
+ 49 			function listener () {
+ 50 				// Internet Explorer fails to correctly set the 'this' object
+ 51 				// for event listeners, so we need to set it ourselves.
+ 52 				callback.apply(arguments[0]);
+ 53 			}
+ 54 			
+ 55 			if (typeof sel.attachEvent !== "undefined")
+ 56 			{
+ 57 				_remove(event, callback); // Make sure we don't have duplicate listeners
+ 58 				
+ 59 				sel.attachEvent("on" + event, listener);
+ 60 				// Store our listener so we can _remove it later
+ 61 				var expando = sel[kis_expando] = sel[kis_expando] || {};
+ 62 				expando.listeners = expando.listeners || {};
+ 63 				expando.listeners[event] = expando.listeners[event] || [];
+ 64 				expando.listeners[event].push({
+ 65 					callback: callback,
+ 66 					listener: listener
+ 67 				});
+ 68 			}
+ 69 			else
+ 70 			{
+ 71 				console.log("Failed to _attach event:"+event+" on "+sel);
+ 72 			}
+ 73 		};
+ 74 		/**
+ 75 		 * @private
+ 76 		 */
+ 77 		_remove = function (sel, event, callback)
+ 78 		{
+ 79 			if(typeof sel.detachEvent !== "undefined")
+ 80 			{
+ 81 				var expando = sel[kis_expando];
+ 82 				if (expando && expando.listeners
+ 83 						&& expando.listeners[event])
+ 84 				{
+ 85 					var listeners = expando.listeners[event];
+ 86 					var len = listeners.length;
+ 87 					for (var i=0; i<len; i++)
+ 88 					{
+ 89 						if (listeners[i].callback === callback)
+ 90 						{
+ 91 							sel.detachEvent("on" + event, listeners[i].listener);
+ 92 							listeners.splice(i, 1);
+ 93 							if(listeners.length === 0)
+ 94 							{
+ 95 								delete expando.listeners[event];
+ 96 							}
+ 97 							return;
+ 98 						}
+ 99 					}
+100 				}
+101 			}
+102 		};
+103 	}
+104 	
+105 	_add_remove = function (sel, event, callback, add)
+106 	{
+107 		var i, len;
+108 		
+109 		if(typeof sel === "undefined")
+110 		{
+111 			console.log(arguments);
+112 			console.log(event);
+113 			return false;
+114 		}
+115 
+116 		//Multiple events? Run recursively!
+117 		if (!event.match(/^([\w\-]+)$/))
+118 		{
+119 			event = event.split(" ");
+120 			
+121 			len = event.length;
+122 
+123 			for (i = 0; i < len; i++)
+124 			{
+125 				_add_remove(sel, event[i], callback, add);
+126 			}
+127 
+128 			return;
+129 		}
+130 
+131 		
+132 		if(add === true)
+133 		{
+134 			_attach(sel, event, callback);
+135 		}
+136 		else
+137 		{
+138 			_remove(sel, event, callback);
+139 		}
+140 	};
+141 
+142 	_attach_delegate = function(sel, target, event, callback)
+143 	{
+144 		//_attach the listener to the parent object
+145 		_add_remove(target, event, function(e){
+146 		
+147 			var i, t;
+148 			
+149 			//Get the live version of the target selector
+150 			t = $_.$(target);
+151 			
+152 			console.log(t);
+153 			
+154 			//Check each element to see if it matches the target
+155 			for(i in t)
+156 			{
+157 				if(t.hasOwnProperty(i))
+158 				{
+159 					//Fire target callback when event bubbles from target
+160 					if(e.target == i)
+161 					{
+162 						//Trigger the event callback
+163 						callback.call(i, e);
+164 						
+165 						//Stop event propegation
+166 						e.stopPropagation();
+167 					}
+168 				}
+169 			}
+170 			
+171 			
+172 		}, true);
+173 	};
+174 	
+175 	// --------------------------------------------------------------------------
+176 
+177 	/**
+178 	 * @namespace
+179 	 * @name event
+180 	 * @memberOf $_
+181 	 */
+182 	e = {
+183 		/**
+184 		 * Adds an event that returns a callback when triggered on the selected
+185 		 * event and selector
+186 		 * 
+187 		 * @memberOf $_.event
+188 		 * @name add
+189 		 * @function
+190 		 * @example Eg. $_("#selector").event.add("click", do_something());
+191 		 * @param string event
+192 		 * @param function callback
+193 		 * @return void
+194 		 */
+195 		add: function (event, callback)
+196 		{
+197 			$_.each(function(e){
+198 				_add_remove(e, event, callback, true);
+199 			});
+200 		},
+201 		/**
+202 		 * Removes an event bound the the specified selector, event type, and callback
+203 		 *
+204 		 * @memberOf $_.event
+205 		 * @name remove
+206 		 * @function
+207 		 * @example Eg. $_("#selector").event.remove("click", do_something());
+208 		 * @param string event
+209 		 * @param string callback
+210 		 * @return void
+211 		 */
+212 		remove: function (event, callback)
+213 		{
+214 			$_.each(function(e){
+215 				_add_remove(e, event, callback, false);
+216 			});
+217 		},
+218 		/** 
+219 		 * Binds a persistent, delegated event
+220 		 * 
+221 		 * @memberOf $_.event
+222 		 * @name live
+223 		 * @function
+224 		 * @example Eg. $_.event.live(".button", "click", do_something());
+225 		 * @param string target
+226 		 * @param string event
+227 		 * @param function callback
+228 		 * @return void
+229 		 */
+230 		live: function (target, event, callback)
+231 		{
+232 			_attach_delegate(document.documentElement, target, event, callback);
+233 		},
+234 		/** 
+235 		 * Binds an event to a parent object
+236 		 *
+237 		 * @memberOf $_.event
+238 		 * @name delegate
+239 		 * @function
+240 		 * @example Eg. $_("#parent").delegate(".button", "click", do_something());
+241 		 * @param string target
+242 		 * @param string event_type
+243 		 * @parma function callback
+244 		 * @return void
+245 		 */
+246 		delegate: function(target, event, callback)
+247 		{
+248 			$_.each(function(e){
+249 				_attach_delegate(e, target, event, callback);
+250 			});
+251 		}
+252 	};
+253 
+254 	$_.ext('event', e);
+255 
+256 }());
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_store.js.html b/docs/symbols/src/kis-js_src_modules_store.js.html new file mode 100755 index 0000000..8778919 --- /dev/null +++ b/docs/symbols/src/kis-js_src_modules_store.js.html @@ -0,0 +1,94 @@ +
  1 (function (){
+  2 	"use strict";
+  3 
+  4 	/**
+  5 	 * Wrapper for localstorage data serialization
+  6 	 *
+  7 	 * @name store
+  8 	 * @namespace
+  9 	 * @memberOf $_
+ 10 	 */
+ 11 	var store = {
+ 12 		/**
+ 13 		 * Retrieves and deserializes a value from localstorage, 
+ 14 		 * based on the specified key
+ 15 		 * 
+ 16 		 * @param string key
+ 17 		 * @name get
+ 18 		 * @memberOf $_.store
+ 19 		 * @function
+ 20 		 * @return object
+ 21 		 */
+ 22 		get: function (key)
+ 23 		{
+ 24 			return JSON.parse(localStorage.getItem(key));
+ 25 		},
+ 26 		/**
+ 27 		 * Puts a value into localstorage at the specified key,
+ 28 		 * and JSON-encodes the value if not a string
+ 29 		 *
+ 30 		 * @param string key
+ 31 		 * @param mixed value
+ 32 		 * @name set
+ 33 		 * @memberOf $_.store
+ 34 		 * @function
+ 35 		 * @return void
+ 36 		 */
+ 37 		set: function (key, value)
+ 38 		{
+ 39 			if (typeof value !== "string")
+ 40 			{
+ 41 				value = JSON.stringify(value);
+ 42 			}
+ 43 			localStorage.setItem(key, value);
+ 44 		},
+ 45 		/**
+ 46 		 * Removes the specified item from localstorage
+ 47 		 * 
+ 48 		 * @param string key
+ 49 		 * @name remove
+ 50 		 * @memberOf $_.store
+ 51 		 * @function
+ 52 		 * @return void 
+ 53 		 */
+ 54 		remove: function (key)
+ 55 		{
+ 56 			localStorage.removeItem(key);
+ 57 		},
+ 58 		/**
+ 59 		 * Returns an array of all the values in localstorage
+ 60 		 * in their raw form
+ 61 		 * 
+ 62 		 * @name getAll
+ 63 		 * @member of $_.store
+ 64 		 * @function
+ 65 		 * @return object
+ 66 		 */
+ 67 		getAll: function ()
+ 68 		{
+ 69 			var i,
+ 70 				len,
+ 71 				data;
+ 72 			len = localStorage.length;
+ 73 			data = {};
+ 74 
+ 75 			for (i = 0; i < len; i++)
+ 76 			{
+ 77 				var name = localStorage.key(i);
+ 78 				var value = localStorage.getItem(name);
+ 79 				data[name] = value;
+ 80 			}
+ 81 
+ 82 			return data;
+ 83 		}
+ 84 	};
+ 85 
+ 86 	$_.ext('store', store);
+ 87 }());
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_util.js.html b/docs/symbols/src/kis-js_src_modules_util.js.html new file mode 100755 index 0000000..4a18275 --- /dev/null +++ b/docs/symbols/src/kis-js_src_modules_util.js.html @@ -0,0 +1,369 @@ +
  1 /**
+  2  * Util Object
+  3  * 
+  4  * Various object and string manipulation functions
+  5  * Note: these are based on similar phpjs functions: http://phpjs.org
+  6  */
+  7 (function(){
+  8 
+  9 	"use strict";
+ 10 
+ 11 	var 
+ 12 	reverse_key_sort =  function(o)
+ 13 	{
+ 14 		//Define some variables
+ 15 		var keys = [],
+ 16 			num_keys = 0,
+ 17 			new_o = {},
+ 18 			i;
+ 19 	
+ 20 		//Extract the keys
+ 21 		keys = u.object_keys(o);
+ 22 		
+ 23 		//Sort the keys
+ 24 		keys.sort(function (b, a) {		
+ 25 			var aFloat = parseFloat(a),
+ 26 				bFloat = parseFloat(b),
+ 27 				aNumeric = aFloat + '' === a,
+ 28 				bNumeric = bFloat + '' === b;
+ 29             
+ 30 			if (aNumeric && bNumeric) 
+ 31 			{
+ 32 				return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0;
+ 33 			} 
+ 34 			else if (aNumeric && !bNumeric) 
+ 35 			{
+ 36 				return 1;
+ 37 			} 
+ 38 			else if (!aNumeric && bNumeric) 
+ 39 			{
+ 40 				return -1;
+ 41 			}
+ 42 			
+ 43 			return a > b ? 1 : a < b ? -1 : 0;
+ 44 		});
+ 45 		
+ 46 		//cache object/array size
+ 47 		num_keys = keys.length;
+ 48 		
+ 49 		//Recreate the object/array
+ 50 		for(i=0; i < num_keys; i++)
+ 51 		{
+ 52 			new_o[keys[i]] = o[keys[i]];
+ 53 		}
+ 54 		
+ 55 		return new_o;
+ 56 	},
+ 57 	
+ 58 	/**
+ 59 	 * String and object manipulation utilities
+ 60 	 *	
+ 61 	 * @namespace
+ 62 	 * @name util
+ 63 	 * @memberOf $_
+ 64 	 */
+ 65 	u = {
+ 66 		/**
+ 67 		 * Retrieve the keys, or member names of an object
+ 68 		 * 
+ 69 		 * @name object_keys
+ 70 		 * @memberOf $_.util
+ 71 		 * @function
+ 72 		 * @param object
+ 73 		 * @return array
+ 74 		 * @type array
+ 75 		 */
+ 76 		object_keys: function(o)
+ 77 		{
+ 78 			var keys = [],
+ 79 				k;
+ 80 				
+ 81 			for(k in o)
+ 82 			{
+ 83 				if(o.hasOwnProperty(k))
+ 84 				{
+ 85 					keys.push(k);
+ 86 				}
+ 87 			}
+ 88 			
+ 89 			return keys;
+ 90 		},
+ 91 		/**
+ 92 		 * Retrieves the values of an object, and returns
+ 93 		 * them as an array
+ 94 		 *
+ 95 		 * @name object_values
+ 96 		 * @memberOf $_.util
+ 97 		 * @function
+ 98 		 * @param object
+ 99 		 * @return array
+100 		 * @type array
+101 		 */
+102 		object_values: function(o)
+103 		{
+104 			var vals = [],
+105 				prop;
+106 			
+107 			for(prop in o)
+108 			{
+109 				vals.push(o[prop]);
+110 			}
+111 			
+112 			return vals;
+113 		},
+114 		/**
+115 		 * Creates an object, with the property names of the first array, 
+116 		 * and the values of the second. If objects are passed, the values 
+117 		 * of the object are used. If the arrays or objects passed are 
+118 		 * not the same size, the function will return false.
+119 		 * 
+120 		 * @name array_combine
+121 		 * @memberOf $_.util
+122 		 * @function
+123 		 * @param array/object keys
+124 		 * @param array/object vals
+125 		 * @return object
+126 		 * @type object
+127 		 */
+128 		array_combine: function(keys, vals)
+129 		{
+130 			var new_object = {},
+131 				num_keys,
+132 				i = 0;
+133 				
+134 			//Extract the keys or values if needed
+135 			if($_.type(keys) !== "array")
+136 			{
+137 				keys = this.object_values(keys);
+138 			}
+139 			if($_.type(vals) !== "array")
+140 			{
+141 				vals = this.object_values(vals);
+142 			}
+143 			
+144 			//cache the number of keys
+145 			num_keys = keys.length;
+146 			
+147 			if(num_keys !== vals.length)
+148 			{
+149 				console.log("Object combine requires two arrays of the same size");
+150 				return false;
+151 			}
+152 			
+153 			//Create and return the new object
+154 			for(i = 0; i < num_keys; i++)
+155 			{
+156 				new_object[keys[i]] = vals[i];
+157 			}
+158 			
+159 			return new_object;
+160 		},
+161 		/**
+162 		 * Combines two or more objects/arrays. If the keys are numeric, the outputted
+163 		 * object will have re-indexed keys. If a key/value pair exists in both objects,
+164 		 * indentical values will be droped, but if a key exists with a different value, 
+165 		 * with the same key, the value in the second array will replace the value in the
+166 		 * first
+167 		 * 
+168 		 * @name object_merge
+169 		 * @memberOf $_.util
+170 		 * @function
+171 		 * @param object [as many as you wish to combine]
+172 		 * @type object
+173 		 * @return object
+174 		 */
+175 		object_merge: function()
+176 		{
+177 			var args = Array.prototype.slice.call(arguments),
+178 				arg_len = args.length,
+179 				new_obj = {},
+180 				arg,
+181 				iarg_len = 0,
+182 				i,
+183 				j,
+184 				x,
+185 				is_array = true;
+186 				
+187 			//Check for an array in the arguments
+188 			for(i=0; i < arg_len; i++)
+189 			{
+190 				if($_.type(args[i]) !== "array")
+191 				{
+192 					is_array = false;
+193 					break;
+194 				}
+195 			}
+196 			
+197 			//If all the arguments are javascript arrays
+198 			if(is_array)
+199 			{
+200 				new_obj = [];
+201 				//Let javascript do all the work!
+202 				for(i=0; i< arg_len; i++)
+203 				{
+204 					new_obj = new_obj.contact(args[i]);
+205 				}
+206 				
+207 				//Return early
+208 				return new_obj;
+209 			}
+210 			
+211 			//No, there's at least one object
+212 			for(i=0, x=0; i < arg_len; i++)
+213 			{
+214 				arg = args[i];
+215 				
+216 				// If the argument is an array, add the array items as
+217 				// numeric object properties
+218 				if ($_.type(arg) == "array")
+219 				{
+220 					for (j=0, iarg_len= arg.length; j < iarg_len; j++)
+221 					{
+222 						new_obj[x++] = arg[j];
+223 					}
+224 				}
+225 				else
+226 				{
+227 					for (j in arg)
+228 					{
+229 						if(arg.hasOwnProperty(j))
+230 						{
+231 							// If the key is numeric, add the property with
+232 							// a numeric key
+233 							if(parseInt(j, 10) + '' === j)
+234 							{
+235 								new_obj[x++] = arg[j];
+236 							}
+237 							else
+238 							{
+239 								new_obj[j] = arg[j];
+240 							} 
+241 						}
+242 					}
+243 				} 
+244 			}
+245 			
+246 			return new_obj;
+247 		},
+248 		/**
+249 		 * Replaces sections of strings in a greedy fashion, 
+250 		 * starting with the longest replace pairs first. Accepts
+251 		 * one replace pair as two parameters, or an object, with
+252 		 * from => to replacements as key/value pairs
+253 		 *
+254 		 * @name str_trans
+255 		 * @memberOf $_.util
+256 		 * @function
+257 		 * @param string input_string
+258 		 * @param mixed
+259 		 * @param [string] to
+260 		 * @return string
+261 		 * @type string
+262 		 */
+263 		str_trans: function(str, from, to)
+264 		{
+265 			var froms = [],
+266 				tos = [],
+267 				ret = '',
+268 				match = false,
+269 				from_len = 0,
+270 				str_len = 0,
+271 				to_len = 0,
+272 				to_is_str = '',
+273 				from_is_str = '',
+274 				strx = '',
+275 				strw = '',
+276 				stry = '',
+277 				from_strx = '',
+278 				new_str = '',
+279 				f,
+280 				i,
+281 				j;
+282 				
+283 			//Replace pairs? add them to the internal arrays
+284 			if(typeof from === 'object')
+285 			{
+286 				// Sort the keys in descending order for better
+287 				// replacement functionality
+288 				from = reverse_key_sort(from);
+289 				
+290 				for(f in from)
+291 				{
+292 					if(from.hasOwnProperty(f))
+293 					{
+294 						froms.push(f);
+295 						tos.push(from[f]);
+296 					}
+297 				}
+298 				
+299 				from = froms;
+300 				to = tos;
+301 			}
+302 			
+303 			//Go through the string, and replace characters as needed
+304 			str_len = str.length;
+305 			from_len = from.length;
+306 			to_len = to.length;
+307 			to_is_str = typeof to === 'string';
+308 			from_is_str = typeof from === 'string';
+309 			
+310 			for(i=0; i < str_len; i++)
+311 			{
+312 				match = false;
+313 				if(from_is_str)
+314 				{
+315 					strw = str.charAt(i-1);
+316 					strx = str.charAt(i);
+317 					stry = str.charAt(i+1);
+318 					for(j=0; j < from_len; j++)
+319 					{
+320 						if(strx == from.charAt(j))
+321 						{
+322 							match = true;
+323 							break;
+324 						}
+325 					}
+326 				}
+327 				else
+328 				{
+329 					for(j=0; j < from_len; j++)
+330 					{
+331 						if(str.substr(i, from[j].length) == from[j])
+332 						{
+333 							match = true;
+334 							
+335 							//Go past the current match
+336 							i = (i + from[j].length) -1;
+337 							break;
+338 
+339 						}
+340 					}
+341 				}
+342 
+343 				if(match)
+344 				{
+345 					new_str += (to_is_str) ? to.charAt(j) : to[j];
+346 				}
+347 				else
+348 				{
+349 					new_str += str.charAt(i);
+350 				}
+351 			}
+352 
+353 			return new_str;
+354 				
+355 		}
+356 	};
+357 
+358 	//Add it to the $_ object
+359 	$_.ext('util', u);
+360 }());
+361 
+362 
\ No newline at end of file diff --git a/docs/ui.js b/docs/ui.js new file mode 100644 index 0000000..d8a80af --- /dev/null +++ b/docs/ui.js @@ -0,0 +1,113 @@ +ui = { + toggleIndex: function() { + $('body').toggleClass('index-collapsed'); + var indexToggler = $('#index-toggler'); + if (encodeURIComponent(indexToggler.html()) == '%C2%AB') + indexToggler.html('»'); + else + indexToggler.html('«'); + }, + + toggleMethods: function() { + $.element.toggleClass(this, 'toggled'); + $('.sectionItems', this.parentNode.parentNode).toggleClass('invisible'); + }, + + toggleModule: function(module) { + if (module) { + var name = 'filter module-'+module; + + if ($('body').toggleClass(name).hasClass(name)) { + createCookie("jProtonDocModule", module); + } else { + eraseCookie("jProtonDocModule"); + } + } + ui.hideEmptySections(); + ui.updateFragmentLocation(); + }, + + hideEmptySections: function() { + var sections = $('.section'); + sections.each(function(i){ + + var count = 0; + var sectionItems = $(this).find('.sectionItems'); + + sectionItems.find('.sectionItem').each(function(){ + if ($.element.css(this, 'display') != 'none') + count++; + }); + + if (sectionItems.e.length > 0 && count == 0) + $.element.addClass(this, 'invisible'); + else + $.element.removeClass(this, 'invisible'); + }); + }, + + updateFragmentLocation: function() { + if (window.location.hash) + window.location.hash = window.location.hash; + }, + + updateModuleState: function() { + var module = readCookie("jProtonDocModule"); + if (module) { + $('body').addClass('filter module-'+module); + ui.hideEmptySections(); + } + ui.updateFragmentLocation(); + } +} + +window.onload = function() { + // Controle para alternar a exibição do outline + $('#index-toggler').attr('title', 'Alterna a exibição do outline'); + $('#index-toggler, #index-close').on('click', ui.toggleIndex); + + // Controle para alternar a exibição de métodos + $('.method-toggler').on('click', ui.toggleMethods); + + // Controle para filtro de módulos + $('.module-filter').attr('title', 'Liga/Desliga filtro do módulo'); + $.each(['core', 'css', 'dom', 'event', 'ajax'], function(i,e){ + $('.module-' + e + ' .module-filter').on('click', function(){ + ui.toggleModule(e); + }); + }); + + ui.updateModuleState(); + + if (typeof dp != 'undefined') + dp.SyntaxHighlighter.HighlightAll('code'); +} + +window.onunload = function() { + $.event.removeAll(); +} + +function createCookie(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else var expires = ""; + document.cookie = name+"="+value+expires+"; path=/"; +} + +function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; +} + +function eraseCookie(name) { + createCookie(name,"",-1); +} diff --git a/kis-all.js b/kis-all.js index afe9a0b..e748e92 100644 --- a/kis-all.js +++ b/kis-all.js @@ -2,7 +2,7 @@ Kis JS Keep It Simple JS Library Copyright Timothy J. Warren License Public Domain - Version 0.3.0 + Version 0.5.0-pre */ (function (){ @@ -14,42 +14,18 @@ return; } - var $_, $, dcopy, sel; + var $_, $, dcopy, sel, sel_string; - /** - * $ - * - * Simple DOM selector function - */ - $ = function (a, context) - { - var x, c; - - if (typeof a != "string" || typeof a === "undefined"){ return a;} - - //Check for a context of a specific element, otherwise, just run on the document - c = (context != null && context.nodeType === 1) - ? context - : document; - - //Pick the quickest method for each kind of selector - if (a.match(/^#([\w\-]+$)/)) - { - return document.getElementById(a.split('#')[1]); - } - else - { - x = c.querySelectorAll(a); - } - - //Return the single object if applicable - return (x.length === 1) ? x[0] : x; - }; /** * $_ * * Constructor function + * + * @constuctor + * @namespace + * @param string selector + * @return object */ $_ = function(s) { @@ -86,8 +62,49 @@ return self; }; + /** + * $ + * + * Simple DOM selector function + * + * @memberOf $_ + * @param string selector + * @param string context + * @return object + * @type object + */ + $ = function (a, context) + { + var x, c; + + if (typeof a != "string" || typeof a === "undefined"){ return a;} + + //Check for a context of a specific element, otherwise, just run on the document + c = (context != null && context.nodeType === 1) + ? context + : document; + + //Pick the quickest method for each kind of selector + if (a.match(/^#([\w\-]+$)/)) + { + return document.getElementById(a.split('#')[1]); + } + else + { + x = c.querySelectorAll(a); + } + + //Return the single object if applicable + return (x.length === 1) ? x[0] : x; + }; + /** * Deep copy/prototypical constructor function + * + * @param object obj + * @private + * @return object + * @type object */ dcopy = function(obj) { @@ -110,6 +127,9 @@ return; } + /** + * @private + */ F = function(){}; F.prototype = obj; @@ -118,14 +138,27 @@ }; - //Function to add to $_ object, and get sel + /** + * Adds the property `obj` to the $_ object, calling it `name` + * + * @param string name + * @param object obj + * @return void + */ $_.ext = function(name, obj) { obj.el = sel; $_[name] = obj; }; - //Selector iteration + /** + * Iterates over a $_ object, applying a callback to each item + * + * @name $_.each + * @function + * @param function callback + * @return void + */ $_.ext('each', function (callback) { if(typeof sel.length !== "undefined" && sel !== window) @@ -150,7 +183,13 @@ } }); - //Type retriever + /** + * Retrieves the type of the passed variable + * + * @param mixed obj + * @return string + * @type string + */ $_.type = function(obj) { if((function() {return obj && (obj !== this)}).call(obj)) @@ -179,6 +218,9 @@ */ if(typeof String.prototype.trim === "undefined") { + /** + * @private + */ String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g, ""); }; @@ -227,12 +269,18 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } // Vendors: please allow content code to instantiate DOMExceptions , + /** + * @private + */ DOMEx = function (type, message) { this.name = type; this.code = DOMException[type]; this.message = message; }, + /** + * @private + */ checkTokenAndGetIndex = function (classList, token) { if (token === "") @@ -245,6 +293,9 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } return arrIndexOf.call(classList, token); }, + /** + * @private + */ ClassList = function (elem) { var @@ -262,6 +313,9 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" }; }, classListProto = ClassList[protoProp] = [], + /** + * @private + */ classListGetter = function () { return new ClassList(this); @@ -344,10 +398,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // -------------------------------------------------------------------------- -/** - * Dom manipulation object - * - */ (function (){ var d, tag_reg, class_reg; @@ -476,23 +526,71 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // -------------------------------------------------------------------------- + /** + * DOM + * + * Dom manipulation module + * @namespace + * @memberOf $_ + * @name dom + */ d = { + /** + * Adds a class to the element(s) specified by the current + * selector + * + * @name addClass + * @memberOf $_.dom + * @function + * @param string class + * @return void + */ addClass: function (c) { $_.each(function (e){ e.classList.add(c); }); }, + /** + * Removes a class from the element(s) specified by the current + * selector + * + * @name removeClass + * @memberOf $_.dom + * @function + * @param string class + * @return void + */ removeClass: function (c) { $_.each(function (e){ e.classList.remove(c); }); }, + /** + * Hides the element(s) specified by the current selector + * + * @name hide + * @memberOf $_.dom + * @function + * @return void + */ hide: function () { this.css('display', 'none'); }, + /** + * Shows the element(s) specified by the current selector. + * if type is specified, the element will have it's style + * property set to "display:[your type]". If type is not + * specified, the element is set to "display:block". + * + * @name show + * @memberOf $_.dom + * @function + * @param [string] type + * @return void + */ show: function (type) { if (typeof type === "undefined") @@ -502,6 +600,20 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" this.css("display", type); }, + /** + * Sets attributes on element(s) specified by the current + * selector, or, if name is not specified, returns the + * value of the attribute of the element specified by the + * current selector. + * + * @name attr + * @memberOf $_.dom + * @function + * @param string name + * @param string value + * @return string + * @type string + */ attr: function (name, value) { var sel = this.el; @@ -524,6 +636,19 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return _attr(sel, name, value); } }, + /** + * Sets or retrieves the text content of the element + * specified by the current selector. If a value is + * passed, it will set that value on the current element, + * otherwise it will return the value of the current element + * + * @name text + * @memberOf $_.util + * @function + * @param [string] value + * @returns string + * @type string + */ text: function (value) { var oldValue, set, type, sel; @@ -550,6 +675,21 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return oldValue; } }, + /** + * Sets or retrieves a css property of the element + * specified by the current selector. If a value is + * passed, it will set that value on the current element, + * otherwise it will return the value of the css property + * on the current element + * + * @name css + * @memberOf $_.util + * @function + * @param string property + * @param [string] value + * @returns string + * @type string + */ css: function (prop, val) { //Return the current value if a value is not set @@ -570,17 +710,42 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // -------------------------------------------------------------------------- -/** - * Store object - * - * Wrapper for localstorage data serialization - */ (function (){ + "use strict"; + + /** + * Wrapper for localstorage data serialization + * + * @name store + * @namespace + * @memberOf $_ + */ var store = { + /** + * Retrieves and deserializes a value from localstorage, + * based on the specified key + * + * @param string key + * @name get + * @memberOf $_.store + * @function + * @return object + */ get: function (key) { return JSON.parse(localStorage.getItem(key)); }, + /** + * Puts a value into localstorage at the specified key, + * and JSON-encodes the value if not a string + * + * @param string key + * @param mixed value + * @name set + * @memberOf $_.store + * @function + * @return void + */ set: function (key, value) { if (typeof value !== "string") @@ -589,10 +754,28 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } localStorage.setItem(key, value); }, + /** + * Removes the specified item from localstorage + * + * @param string key + * @name remove + * @memberOf $_.store + * @function + * @return void + */ remove: function (key) { localStorage.removeItem(key); }, + /** + * Returns an array of all the values in localstorage + * in their raw form + * + * @name getAll + * @member of $_.store + * @function + * @return object + */ getAll: function () { var i, @@ -617,104 +800,10 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // -------------------------------------------------------------------------- -/** - * Qs - * - * Object for encoding and decoding querystrings and hashbang strings - */ -(function (){ - - $_.hb = (history.pushState) ? false : true; - - var qs = { - parse: function (hb) - { - hb = hb || $_.hb; - - var h, i, hString, pairs, pLen, data, y; - - data = {}; - - if (hb === true) - { - h = location.hash.split('#!/'); - hString = (h.length > 1) ? h[1] : ''; - } - else if (hb === false || hb === undefined) - { - hString = window.location.search.substring(1); - } - else - { - return false; - } - - pairs = hString.split('&'); - - pLen = pairs.length; - - for (i = 0; i < pLen; i++) - { - y = pairs[i].split('='); - - if (y.length < 2) - { - return data; - } - - data[y[0]] = y[1]; - } - - return data; - }, - set: function (key, value, hb) - { - hb = hb || $_.hb; - var pairs = this.parse(hb); - - if (key !== undefined && value !== undefined) - { - pairs[key] = value; - } - - var vars = []; - - for (var x in pairs) - { - if (pairs.hasOwnProperty(x)) - { - vars.push(x + '=' + pairs[x]); - } - } - - var qs = vars.join('&'); - - if (hb === true) - { - qs = '!/' + qs; - location.hash = qs; - } - - return qs; - }, - get: function (key, hb) - { - hb = hb || $_.hb; - var pairs = this.parse(hb); - return (pairs[key]) ? pairs[key] : ''; - } - }; - - $_.ext('qs', qs); - -}()); - -// -------------------------------------------------------------------------- - /** * Ajax * - * Object for making ajax requests + * Module for making ajax requests */ (function (){ @@ -723,6 +812,9 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" { if (typeof callback === "undefined") { + /** + * @private + */ callback = function (){}; } @@ -781,10 +873,32 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } }; + /** + * Sends a GET type ajax request + * + * @name get + * @function + * @memberOf $_ + * @param string url + * @param object data + * @param function callback + * @return void + */ $_.ext('get', function (url, data, callback){ ajax._do(url, data, callback, false); }); - + + /** + * Sends a POST type ajax request + * + * @name post + * @function + * @memberOf $_ + * @param string url + * @param object data + * @param function callback + * @return void + */ $_.ext('post', function (url, data, callback){ ajax._do(url, data, callback, true); }); @@ -848,7 +962,25 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return new_o; }, + + /** + * String and object manipulation utilities + * + * @namespace + * @name util + * @memberOf $_ + */ u = { + /** + * Retrieve the keys, or member names of an object + * + * @name object_keys + * @memberOf $_.util + * @function + * @param object + * @return array + * @type array + */ object_keys: function(o) { var keys = [], @@ -864,6 +996,17 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return keys; }, + /** + * Retrieves the values of an object, and returns + * them as an array + * + * @name object_values + * @memberOf $_.util + * @function + * @param object + * @return array + * @type array + */ object_values: function(o) { var vals = [], @@ -876,6 +1019,20 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return vals; }, + /** + * Creates an object, with the property names of the first array, + * and the values of the second. If objects are passed, the values + * of the object are used. If the arrays or objects passed are + * not the same size, the function will return false. + * + * @name array_combine + * @memberOf $_.util + * @function + * @param array/object keys + * @param array/object vals + * @return object + * @type object + */ array_combine: function(keys, vals) { var new_object = {}, @@ -909,6 +1066,20 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return new_object; }, + /** + * Combines two or more objects/arrays. If the keys are numeric, the outputted + * object will have re-indexed keys. If a key/value pair exists in both objects, + * indentical values will be droped, but if a key exists with a different value, + * with the same key, the value in the second array will replace the value in the + * first + * + * @name object_merge + * @memberOf $_.util + * @function + * @param object [as many as you wish to combine] + * @type object + * @return object + */ object_merge: function() { var args = Array.prototype.slice.call(arguments), @@ -982,6 +1153,21 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" return new_obj; }, + /** + * Replaces sections of strings in a greedy fashion, + * starting with the longest replace pairs first. Accepts + * one replace pair as two parameters, or an object, with + * from => to replacements as key/value pairs + * + * @name str_trans + * @memberOf $_.util + * @function + * @param string input_string + * @param mixed + * @param [string] to + * @return string + * @type string + */ str_trans: function(str, from, to) { var froms = [], @@ -1085,7 +1271,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // -------------------------------------------------------------------------- /** - * Event object + * Event * * Event api wrapper */ @@ -1094,28 +1280,43 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" "use strict"; // Property name for expandos on DOM objects - var kis_expando = "KIS_0_3_0"; + var kis_expando = "KIS_0_5_0"; - var attach, remove, add_remove, e, attach_delegate, attach_live; + var _attach, _remove, _add_remove, e, _attach_delegate; - // Define the proper attach and remove functions + // Define the proper _attach and _remove functions // based on browser support if(typeof document.addEventListener !== "undefined") { - attach = function (sel, event, callback) + /** + * @private + */ + _attach = function (sel, event, callback) { - sel.removeEventListener(event, callback, false); - sel.addEventListener(event, callback, false); + if(typeof sel.addEventListener !== "undefined") + { + //Duplicated events are dropped, per the specification + sel.addEventListener(event, callback, false); + } }; - remove = function (sel, event, callback) + /** + * @private + */ + _remove = function (sel, event, callback) { - sel.removeEventListener(event, callback, false); + if(typeof sel.removeEventListener !== "undefined") + { + sel.removeEventListener(event, callback, false); + } }; } - //typeof function doesn't work in IE where attachEvent is available: brute force it + //typeof function doesn't work in IE where _attachEvent is available: brute force it else if(typeof document.attachEvent !== "undefined") { - attach = function (sel, event, callback) + /** + * @private + */ + _attach = function (sel, event, callback) { function listener () { // Internet Explorer fails to correctly set the 'this' object @@ -1125,10 +1326,10 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" if (typeof sel.attachEvent !== "undefined") { - remove(event, callback); // Make sure we don't have duplicate listeners + _remove(event, callback); // Make sure we don't have duplicate listeners sel.attachEvent("on" + event, listener); - // Store our listener so we can remove it later + // Store our listener so we can _remove it later var expando = sel[kis_expando] = sel[kis_expando] || {}; expando.listeners = expando.listeners || {}; expando.listeners[event] = expando.listeners[event] || []; @@ -1139,10 +1340,13 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } else { - console.log("Failed to attach event:"+event+" on "+sel); + console.log("Failed to _attach event:"+event+" on "+sel); } }; - remove = function (sel, event, callback) + /** + * @private + */ + _remove = function (sel, event, callback) { if(typeof sel.detachEvent !== "undefined") { @@ -1169,8 +1373,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } }; } - - add_remove = function (sel, event, callback, add) + + _add_remove = function (sel, event, callback, add) { var i, len; @@ -1190,7 +1394,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" for (i = 0; i < len; i++) { - add_remove(sel, event[i], callback, add); + _add_remove(sel, event[i], callback, add); } return; @@ -1199,60 +1403,124 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" if(add === true) { - attach(sel, event, callback); + _attach(sel, event, callback); } else { - remove(sel, event, callback); + _remove(sel, event, callback); } }; - - attach_delegate = function(sel, target, event, callback) + + _attach_delegate = function(sel, target, event, callback) { - - //Attach the listener to the parent object - add_remove(sel, event, function(e){ + //_attach the listener to the parent object + _add_remove(target, event, function(e){ + var i, t; + //Get the live version of the target selector - sel = $_.$(sel); - - - //todo: fire target callback when event bubbles from target + t = $_.$(target); + + console.log(t); + + //Check each element to see if it matches the target + for(i in t) + { + if(t.hasOwnProperty(i)) + { + //Fire target callback when event bubbles from target + if(e.target == i) + { + //Trigger the event callback + callback.call(i, e); + + //Stop event propegation + e.stopPropagation(); + } + } + } + + }, true); }; - attach_live = function(target, event, callback) - { - attach_delegate(document.documentElement, target, event, callback); - }; - // -------------------------------------------------------------------------- + /** + * @namespace + * @name event + * @memberOf $_ + */ e = { + /** + * Adds an event that returns a callback when triggered on the selected + * event and selector + * + * @memberOf $_.event + * @name add + * @function + * @example Eg. $_("#selector").event.add("click", do_something()); + * @param string event + * @param function callback + * @return void + */ add: function (event, callback) { $_.each(function(e){ - add_remove(e, event, callback, true); + _add_remove(e, event, callback, true); }); }, + /** + * Removes an event bound the the specified selector, event type, and callback + * + * @memberOf $_.event + * @name remove + * @function + * @example Eg. $_("#selector").event.remove("click", do_something()); + * @param string event + * @param string callback + * @return void + */ remove: function (event, callback) { $_.each(function(e){ - add_remove(e, event, callback, false); - }); - }/*, - live: function (event, callback) - { - $_.each(function(e){ - attach_live(e, event, callback); + _add_remove(e, event, callback, false); }); }, + /** + * Binds a persistent, delegated event + * + * @memberOf $_.event + * @name live + * @function + * @example Eg. $_.event.live(".button", "click", do_something()); + * @param string target + * @param string event + * @param function callback + * @return void + */ + live: function (target, event, callback) + { + _attach_delegate(document.documentElement, target, event, callback); + }, + /** + * Binds an event to a parent object + * + * @memberOf $_.event + * @name delegate + * @function + * @example Eg. $_("#parent").delegate(".button", "click", do_something()); + * @param string target + * @param string event_type + * @parma function callback + * @return void + */ delegate: function(target, event, callback) { $_.each(function(e){ - attach_delegate(e, target, event, callback); + _attach_delegate(e, target, event, callback); }); - }*/ + } }; $_.ext('event', e); diff --git a/kis-min.js b/kis-min.js index 402aedd..681177e 100644 --- a/kis-min.js +++ b/kis-min.js @@ -1,22 +1,20 @@ -(function(){if(document.querySelectorAll){var c,f,g,a;f=function(b,a){var e;if(typeof b!="string"||typeof b==="undefined")return b;e=a!=null&&a.nodeType===1?a:document;if(b.match(/^#([\w\-]+$)/))return document.getElementById(b.split("#")[1]);else e=e.querySelectorAll(b);return e.length===1?e[0]:e};c=function(b){a=typeof b==="undefined"?typeof c.el!=="undefined"?c.el:document.documentElement:typeof b!=="object"?f(b):b;c.prototype.el=a;var b=g(c),d;for(d in b)if(typeof b[d]==="object")b[d].el=a;b.el= -a;return b};g=function(a){var d;if(typeof a!=="undefined"){if(typeof Object.create!=="undefined")return Object.create(a);d=typeof a;if(!(d!=="object"&&d!=="function"))return d=function(){},d.prototype=a,new d}};c.ext=function(b,d){d.el=a;c[b]=d};c.ext("each",function(b){if(typeof a.length!=="undefined"&&a!==window){var d=a.length;if(d!==0)for(var e,c=0;c1&&typeof b==="undefined")console.log(d),console.log("Must be a singular element");else if(d.length>1&&typeof b!== -"undefined")$_.each(function(d){return c(d,a,b)});else return c(d,a,b)},text:function(a){var b,d,c;c=this.el;d=typeof c.innerText!=="undefined"?"innerText":typeof c.textContent!=="undefined"?"textContent":"innerHTML";b=c[d];return typeof a!=="undefined"?c[d]=a:b},css:function(a,b){if(typeof b==="undefined")return g(this.el,a);$_.each(function(d){g(d,a,b)})}})})(); -(function(){$_.ext("store",{get:function(c){return JSON.parse(localStorage.getItem(c))},set:function(c,f){typeof f!=="string"&&(f=JSON.stringify(f));localStorage.setItem(c,f)},remove:function(c){localStorage.removeItem(c)},getAll:function(){var c,f,g;f=localStorage.length;g={};for(c=0;c1?c[1]:"";else if(c===false||c===void 0)c=window.location.search.substring(1);else return false;f=c.split("&");g=f.length;for(c=0;cc?1:da?1:b1&&typeof a==="undefined")console.log(c),console.log("Must be a singular element");else if(c.length>1&&typeof a!== +"undefined")$_.each(function(c){return d(c,b,a)});else return d(c,b,a)},text:function(b){var a,c,e;e=this.el;c=typeof e.innerText!=="undefined"?"innerText":typeof e.textContent!=="undefined"?"textContent":"innerHTML";a=e[c];return typeof b!=="undefined"?e[c]=b:a},css:function(b,a){if(typeof a==="undefined")return f(this.el,b);$_.each(function(c){f(c,b,a)})}})})(); +(function(){$_.ext("store",{get:function(d){return JSON.parse(localStorage.getItem(d))},set:function(d,h){typeof h!=="string"&&(h=JSON.stringify(h));localStorage.setItem(d,h)},remove:function(d){localStorage.removeItem(d)},getAll:function(){var d,h,f;h=localStorage.length;f={};for(d=0;de?1:ba?1:c 1) ? h[1] : ''; - } - else if (hb === false || hb === undefined) - { - hString = window.location.search.substring(1); - } - else - { - return false; - } - - pairs = hString.split('&'); - - pLen = pairs.length; - - for (i = 0; i < pLen; i++) - { - y = pairs[i].split('='); - - if (y.length < 2) - { - return data; - } - - data[y[0]] = y[1]; - } - - return data; - }, - set: function (key, value, hb) - { - hb = hb || $_.hb; - var pairs = this.parse(hb); - - if (key !== undefined && value !== undefined) - { - pairs[key] = value; - } - - var vars = []; - - for (var x in pairs) - { - if (pairs.hasOwnProperty(x)) - { - vars.push(x + '=' + pairs[x]); - } - } - - var qs = vars.join('&'); - - if (hb === true) - { - qs = '!/' + qs; - location.hash = qs; - } - - return qs; - }, - get: function (key, hb) - { - hb = hb || $_.hb; - var pairs = this.parse(hb); - return (pairs[key]) ? pairs[key] : ''; - } - }; - - $_.ext('qs', qs); - -}()); diff --git a/src/modules/ajax.js b/src/modules/ajax.js index 050f649..45afe81 100644 --- a/src/modules/ajax.js +++ b/src/modules/ajax.js @@ -1,7 +1,7 @@ /** * Ajax * - * Object for making ajax requests + * Module for making ajax requests */ (function (){ @@ -10,6 +10,9 @@ { if (typeof callback === "undefined") { + /** + * @private + */ callback = function (){}; } @@ -68,10 +71,32 @@ } }; + /** + * Sends a GET type ajax request + * + * @name get + * @function + * @memberOf $_ + * @param string url + * @param object data + * @param function callback + * @return void + */ $_.ext('get', function (url, data, callback){ ajax._do(url, data, callback, false); }); - + + /** + * Sends a POST type ajax request + * + * @name post + * @function + * @memberOf $_ + * @param string url + * @param object data + * @param function callback + * @return void + */ $_.ext('post', function (url, data, callback){ ajax._do(url, data, callback, true); }); diff --git a/src/modules/event.js b/src/modules/event.js index ad385c9..73d916d 100644 --- a/src/modules/event.js +++ b/src/modules/event.js @@ -1,5 +1,5 @@ /** - * Event object + * Event * * Event api wrapper */ @@ -8,28 +8,43 @@ "use strict"; // Property name for expandos on DOM objects - var kis_expando = "KIS_0_3_0"; + var kis_expando = "KIS_0_5_0"; - var attach, remove, add_remove, e, attach_delegate, attach_live; + var _attach, _remove, _add_remove, e, _attach_delegate; - // Define the proper attach and remove functions + // Define the proper _attach and _remove functions // based on browser support if(typeof document.addEventListener !== "undefined") { - attach = function (sel, event, callback) + /** + * @private + */ + _attach = function (sel, event, callback) { - sel.removeEventListener(event, callback, false); - sel.addEventListener(event, callback, false); + if(typeof sel.addEventListener !== "undefined") + { + //Duplicated events are dropped, per the specification + sel.addEventListener(event, callback, false); + } }; - remove = function (sel, event, callback) + /** + * @private + */ + _remove = function (sel, event, callback) { - sel.removeEventListener(event, callback, false); + if(typeof sel.removeEventListener !== "undefined") + { + sel.removeEventListener(event, callback, false); + } }; } - //typeof function doesn't work in IE where attachEvent is available: brute force it + //typeof function doesn't work in IE where _attachEvent is available: brute force it else if(typeof document.attachEvent !== "undefined") { - attach = function (sel, event, callback) + /** + * @private + */ + _attach = function (sel, event, callback) { function listener () { // Internet Explorer fails to correctly set the 'this' object @@ -39,10 +54,10 @@ if (typeof sel.attachEvent !== "undefined") { - remove(event, callback); // Make sure we don't have duplicate listeners + _remove(event, callback); // Make sure we don't have duplicate listeners sel.attachEvent("on" + event, listener); - // Store our listener so we can remove it later + // Store our listener so we can _remove it later var expando = sel[kis_expando] = sel[kis_expando] || {}; expando.listeners = expando.listeners || {}; expando.listeners[event] = expando.listeners[event] || []; @@ -53,10 +68,13 @@ } else { - console.log("Failed to attach event:"+event+" on "+sel); + console.log("Failed to _attach event:"+event+" on "+sel); } }; - remove = function (sel, event, callback) + /** + * @private + */ + _remove = function (sel, event, callback) { if(typeof sel.detachEvent !== "undefined") { @@ -83,8 +101,8 @@ } }; } - - add_remove = function (sel, event, callback, add) + + _add_remove = function (sel, event, callback, add) { var i, len; @@ -104,7 +122,7 @@ for (i = 0; i < len; i++) { - add_remove(sel, event[i], callback, add); + _add_remove(sel, event[i], callback, add); } return; @@ -113,60 +131,124 @@ if(add === true) { - attach(sel, event, callback); + _attach(sel, event, callback); } else { - remove(sel, event, callback); + _remove(sel, event, callback); } }; - - attach_delegate = function(sel, target, event, callback) + + _attach_delegate = function(sel, target, event, callback) { - - //Attach the listener to the parent object - add_remove(sel, event, function(e){ + //_attach the listener to the parent object + _add_remove(target, event, function(e){ + var i, t; + //Get the live version of the target selector - sel = $_.$(sel); - - - //todo: fire target callback when event bubbles from target + t = $_.$(target); + + console.log(t); + + //Check each element to see if it matches the target + for(i in t) + { + if(t.hasOwnProperty(i)) + { + //Fire target callback when event bubbles from target + if(e.target == i) + { + //Trigger the event callback + callback.call(i, e); + + //Stop event propegation + e.stopPropagation(); + } + } + } + + }, true); }; - attach_live = function(target, event, callback) - { - attach_delegate(document.documentElement, target, event, callback); - }; - // -------------------------------------------------------------------------- + /** + * @namespace + * @name event + * @memberOf $_ + */ e = { + /** + * Adds an event that returns a callback when triggered on the selected + * event and selector + * + * @memberOf $_.event + * @name add + * @function + * @example Eg. $_("#selector").event.add("click", do_something()); + * @param string event + * @param function callback + * @return void + */ add: function (event, callback) { $_.each(function(e){ - add_remove(e, event, callback, true); + _add_remove(e, event, callback, true); }); }, + /** + * Removes an event bound the the specified selector, event type, and callback + * + * @memberOf $_.event + * @name remove + * @function + * @example Eg. $_("#selector").event.remove("click", do_something()); + * @param string event + * @param string callback + * @return void + */ remove: function (event, callback) { $_.each(function(e){ - add_remove(e, event, callback, false); - }); - }/*, - live: function (event, callback) - { - $_.each(function(e){ - attach_live(e, event, callback); + _add_remove(e, event, callback, false); }); }, + /** + * Binds a persistent, delegated event + * + * @memberOf $_.event + * @name live + * @function + * @example Eg. $_.event.live(".button", "click", do_something()); + * @param string target + * @param string event + * @param function callback + * @return void + */ + live: function (target, event, callback) + { + _attach_delegate(document.documentElement, target, event, callback); + }, + /** + * Binds an event to a parent object + * + * @memberOf $_.event + * @name delegate + * @function + * @example Eg. $_("#parent").delegate(".button", "click", do_something()); + * @param string target + * @param string event_type + * @parma function callback + * @return void + */ delegate: function(target, event, callback) { $_.each(function(e){ - attach_delegate(e, target, event, callback); + _attach_delegate(e, target, event, callback); }); - }*/ + } }; $_.ext('event', e); diff --git a/src/modules/store.js b/src/modules/store.js index 1b995cb..f418b1d 100644 --- a/src/modules/store.js +++ b/src/modules/store.js @@ -1,14 +1,39 @@ -/** - * Store object - * - * Wrapper for localstorage data serialization - */ (function (){ + "use strict"; + + /** + * Wrapper for localstorage data serialization + * + * @name store + * @namespace + * @memberOf $_ + */ var store = { + /** + * Retrieves and deserializes a value from localstorage, + * based on the specified key + * + * @param string key + * @name get + * @memberOf $_.store + * @function + * @return object + */ get: function (key) { return JSON.parse(localStorage.getItem(key)); }, + /** + * Puts a value into localstorage at the specified key, + * and JSON-encodes the value if not a string + * + * @param string key + * @param mixed value + * @name set + * @memberOf $_.store + * @function + * @return void + */ set: function (key, value) { if (typeof value !== "string") @@ -17,10 +42,28 @@ } localStorage.setItem(key, value); }, + /** + * Removes the specified item from localstorage + * + * @param string key + * @name remove + * @memberOf $_.store + * @function + * @return void + */ remove: function (key) { localStorage.removeItem(key); }, + /** + * Returns an array of all the values in localstorage + * in their raw form + * + * @name getAll + * @member of $_.store + * @function + * @return object + */ getAll: function () { var i, diff --git a/src/modules/util.js b/src/modules/util.js index ca25a63..d5d4b69 100644 --- a/src/modules/util.js +++ b/src/modules/util.js @@ -54,7 +54,25 @@ return new_o; }, + + /** + * String and object manipulation utilities + * + * @namespace + * @name util + * @memberOf $_ + */ u = { + /** + * Retrieve the keys, or member names of an object + * + * @name object_keys + * @memberOf $_.util + * @function + * @param object + * @return array + * @type array + */ object_keys: function(o) { var keys = [], @@ -70,6 +88,17 @@ return keys; }, + /** + * Retrieves the values of an object, and returns + * them as an array + * + * @name object_values + * @memberOf $_.util + * @function + * @param object + * @return array + * @type array + */ object_values: function(o) { var vals = [], @@ -82,6 +111,20 @@ return vals; }, + /** + * Creates an object, with the property names of the first array, + * and the values of the second. If objects are passed, the values + * of the object are used. If the arrays or objects passed are + * not the same size, the function will return false. + * + * @name array_combine + * @memberOf $_.util + * @function + * @param array/object keys + * @param array/object vals + * @return object + * @type object + */ array_combine: function(keys, vals) { var new_object = {}, @@ -115,6 +158,20 @@ return new_object; }, + /** + * Combines two or more objects/arrays. If the keys are numeric, the outputted + * object will have re-indexed keys. If a key/value pair exists in both objects, + * indentical values will be droped, but if a key exists with a different value, + * with the same key, the value in the second array will replace the value in the + * first + * + * @name object_merge + * @memberOf $_.util + * @function + * @param object [as many as you wish to combine] + * @type object + * @return object + */ object_merge: function() { var args = Array.prototype.slice.call(arguments), @@ -188,6 +245,21 @@ return new_obj; }, + /** + * Replaces sections of strings in a greedy fashion, + * starting with the longest replace pairs first. Accepts + * one replace pair as two parameters, or an object, with + * from => to replacements as key/value pairs + * + * @name str_trans + * @memberOf $_.util + * @function + * @param string input_string + * @param mixed + * @param [string] to + * @return string + * @type string + */ str_trans: function(str, from, to) { var froms = [], diff --git a/tests/tests/core.js b/tests/tests/core.js index b4e4419..af48563 100644 --- a/tests/tests/core.js +++ b/tests/tests/core.js @@ -53,9 +53,9 @@ test("Sub-modules", function(){ expect(4); - ok($_.qs, "Query String module"); ok($_().event, "Event module"); ok($_.store, "Local Storage module"); ok($_().dom, "Dom manipulation module"); + ok($_.util, "Utilities module"); }); }()); \ No newline at end of file