From 4cb79f9e85a24fabd09a96015fce65079bf83c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Tue, 31 May 2016 23:32:39 +0800 Subject: [PATCH] Restructure --- botanjs/src/Astro/Blog/Components/Comment.js | 2 +- botanjs/src/Astro/Blog/Element/Footer.js | 2 - botanjs/src/Astro/Blog/Element/Header.js | 1 - botanjs/src/Astro/Blog/Element/Layer.js | 1 - botanjs/src/Astro/Blog/Layout/MainFrame.css | 62 ------------------- botanjs/src/Astro/Blog/Layout/MainFrame.js | 52 +--------------- .../{Blog => Starfall}/Element/Footer.css | 0 botanjs/src/Astro/Starfall/Element/Footer.js | 2 + .../{Blog => Starfall}/Element/Header.css | 0 botanjs/src/Astro/Starfall/Element/Header.js | 1 + .../{Blog => Starfall}/Element/Layer.css | 0 botanjs/src/Astro/Starfall/Element/Layer.js | 1 + .../src/Astro/Starfall/Layout/MainFrame.css | 58 +++++++++++++++++ .../src/Astro/Starfall/Layout/MainFrame.js | 61 ++++++++++++++++++ .../{Blog => Starfall}/Layout/PureColumn.css | 0 .../{Blog => Starfall}/Layout/PureColumn.js | 2 +- .../{Blog => Starfall}/Layout/TwoColumn.css | 0 .../{Blog => Starfall}/Layout/TwoColumn.js | 4 +- botanjs/src/Astro/Starfall/_this.js | 3 + 19 files changed, 132 insertions(+), 120 deletions(-) delete mode 100644 botanjs/src/Astro/Blog/Element/Footer.js delete mode 100644 botanjs/src/Astro/Blog/Element/Header.js delete mode 100644 botanjs/src/Astro/Blog/Element/Layer.js rename botanjs/src/Astro/{Blog => Starfall}/Element/Footer.css (100%) create mode 100644 botanjs/src/Astro/Starfall/Element/Footer.js rename botanjs/src/Astro/{Blog => Starfall}/Element/Header.css (100%) create mode 100644 botanjs/src/Astro/Starfall/Element/Header.js rename botanjs/src/Astro/{Blog => Starfall}/Element/Layer.css (100%) create mode 100644 botanjs/src/Astro/Starfall/Element/Layer.js create mode 100644 botanjs/src/Astro/Starfall/Layout/MainFrame.css create mode 100644 botanjs/src/Astro/Starfall/Layout/MainFrame.js rename botanjs/src/Astro/{Blog => Starfall}/Layout/PureColumn.css (100%) rename botanjs/src/Astro/{Blog => Starfall}/Layout/PureColumn.js (96%) rename botanjs/src/Astro/{Blog => Starfall}/Layout/TwoColumn.css (100%) rename botanjs/src/Astro/{Blog => Starfall}/Layout/TwoColumn.js (84%) create mode 100644 botanjs/src/Astro/Starfall/_this.js diff --git a/botanjs/src/Astro/Blog/Components/Comment.js b/botanjs/src/Astro/Blog/Components/Comment.js index dffd731..b1bfda2 100644 --- a/botanjs/src/Astro/Blog/Components/Comment.js +++ b/botanjs/src/Astro/Blog/Components/Comment.js @@ -684,7 +684,7 @@ var stage = c_body.parentNode BotanJS.addEventListener( "Responsive" - /** e @type {Astro.Blog.Events.Responsive} */ + /** e @type {Astro.Starfall.Events.Responsive} */ , function( e ) { e.data.ratio < 1 ? stage.style.width = "100%" diff --git a/botanjs/src/Astro/Blog/Element/Footer.js b/botanjs/src/Astro/Blog/Element/Footer.js deleted file mode 100644 index d8f0624..0000000 --- a/botanjs/src/Astro/Blog/Element/Footer.js +++ /dev/null @@ -1,2 +0,0 @@ -// __namespace( "Astro.Blog.Element.Footer" ); -// __import( "Astro.Common.Element.Footer" ); diff --git a/botanjs/src/Astro/Blog/Element/Header.js b/botanjs/src/Astro/Blog/Element/Header.js deleted file mode 100644 index 022a1f8..0000000 --- a/botanjs/src/Astro/Blog/Element/Header.js +++ /dev/null @@ -1 +0,0 @@ -// __namespace( "Astro.Blog.Element.Header" ); diff --git a/botanjs/src/Astro/Blog/Element/Layer.js b/botanjs/src/Astro/Blog/Element/Layer.js deleted file mode 100644 index 49ab51f..0000000 --- a/botanjs/src/Astro/Blog/Element/Layer.js +++ /dev/null @@ -1 +0,0 @@ -// __namespace( "Astro.Blog.Element.Layer" ); diff --git a/botanjs/src/Astro/Blog/Layout/MainFrame.css b/botanjs/src/Astro/Blog/Layout/MainFrame.css index 8669d98..1d6b6e7 100644 --- a/botanjs/src/Astro/Blog/Layout/MainFrame.css +++ b/botanjs/src/Astro/Blog/Layout/MainFrame.css @@ -1,63 +1,3 @@ -html, body { height: 100%; } - -html { background-color: #222; } - -body { - background-color: #F0F0F0; - font-family: custom-sans,Helvetica,Arial,STHeiti,"Microsoft JhengHei","微軟正黑體"; -} - -pre { font-family: monospace; } - -::selection { - color: white; - background: purple; -} -::-moz-selection { - color: white; - background: purple; -} - -p { padding: 0.5em; } - -a { - color: #333; - text-decoration: none; -} - -sup { vertical-align: super; } - -a:hover { text-decoration: underline; } - -.clearfix { - clear: both; - padding: 0 !important; - margin: 0 !important; -} - -.begin-wrapper { - position: relative; - - min-height: 100%; - background-color: #EBEAEF; - - overflow: hidden; -} - -.mbody { - position: relative; - width: 100%; -} - -.main-column { - width: 85%; - margin: 0 auto; -} - -.right { text-align: right; } -.panel { padding: 0.5em 1.2em 1.2em 1.2em; } - -/* transition properties */ div#header, div#mbody, div#contact, div#horizon { -webkit-transition: all 500ms cubic-bezier(0.770, 0.000, 0.175, 1.000); @@ -97,5 +37,3 @@ div#header, div#mbody, div#contact, div#horizon { } .cw { animation-name: spin; } - -/* end transition properties */ diff --git a/botanjs/src/Astro/Blog/Layout/MainFrame.js b/botanjs/src/Astro/Blog/Layout/MainFrame.js index 70837b4..35da26d 100644 --- a/botanjs/src/Astro/Blog/Layout/MainFrame.js +++ b/botanjs/src/Astro/Blog/Layout/MainFrame.js @@ -5,14 +5,10 @@ var Cycle = __import( "System.Cycle" ); /** @type {System.Cycle.Trigger} */ var Trigger = __import( "System.Cycle.Trigger" ); - /** @type {System.utils.IKey} */ - var IKey = __import( "System.utils.IKey" ); /** @type {System.utils.DataKey} */ var DataKey = __import( "System.utils.DataKey" ); /** @type {Dandelion} */ var Dand = __import( "Dandelion" ); - /** @type {Dandelion.IDOMObject} */ - var IDOMObject = __import( "Dandelion.IDOMObject" ); /** @type {Dandelion.IDOMElement} */ var IDOMElement = __import( "Dandelion.IDOMElement" ); /** @type {Dandelion.Window} */ @@ -29,49 +25,24 @@ // __import( "Dandelion.CSSReset" ); CSS_RESERVATION // __import( "Dandelion.CSSAnimations" ); CSS_RESERVATION // __import( "Astro.Blog.SharedStyle" ); CSS_RESERVATION - // __import( "Astro.Blog.Element.Layer" ); CSS_RESERVATION + // __import( "Astro.Starfall.Element.Layer" ); CSS_RESERVATION /** @function {System.Net.getData} */ var getData = __import( "System.Net.getData" ); - var main; var header; - var main_h; // menu and horizon var horizon; var contact; - var contaht_page; + var contact_page; var collapse_panel; var c_expand = false; - var savedPath; var init = function () { - // Footer at bottom - var padder = Dand.wrap(); - var begin_wrapper = Dand.id( "begin-wrapper" ); - var content_wrapper = Dand.id( "mbody" ); - var footer = Dand.tag( "footer" ); - var fhorizon = Dand.id( "fhorizon" ); - - if( footer.length ) - { - footer = footer[0]; - var fheight = footer.scrollHeight || footer.offsetHeight; - var hheight = fhorizon.scrollHeight || fhorizon.offsetHeight; - - padder.style.height = ( fheight + hheight ) + "px"; - begin_wrapper.style.marginBottom = "-" + fheight + "px"; - } - - content_wrapper.appendChild( padder ); - - IDOMObject( window ).addEventListener( "Resize", responsify ); - initTopButton(); navControl(); - responsify( null, true ); initBackgroundParallax(); }; @@ -81,7 +52,6 @@ // init params header = Dand.id( "header" ); horizon = Dand.id( "horizon" ); - main = Dand.id( "mbody" ); contact_page = Dand.id( "contact" ); collapse_panel = Dand.id( "collapse_panel" ); @@ -149,24 +119,6 @@ } }; - /** @type {Dandelion.IDOMElement} */ - var rspd_ratio = 0; - var responsify = function( e, override ) - { - // Ratio changes would trigger content - var ratio = wsupp.clientWidth / wsupp.clientHeight; - - // Swap only on ration changes from 1 < x OR x < 1 - if( ( ratio < 1.2 && 1.2 < rspd_ratio ) || ( 1.2 < ratio && rspd_ratio < 1.2 ) || override ) - { - rspd_ratio = ratio; - debug.Info( "Responsive Event: R = " + ratio ); - - BotanJS.dispatchEvent( new BotanEvent( "Responsive", { "ratio": ratio } ) ); - } - }; - - /////// Menu // Contact var expandContact = function () diff --git a/botanjs/src/Astro/Blog/Element/Footer.css b/botanjs/src/Astro/Starfall/Element/Footer.css similarity index 100% rename from botanjs/src/Astro/Blog/Element/Footer.css rename to botanjs/src/Astro/Starfall/Element/Footer.css diff --git a/botanjs/src/Astro/Starfall/Element/Footer.js b/botanjs/src/Astro/Starfall/Element/Footer.js new file mode 100644 index 0000000..dcf4f37 --- /dev/null +++ b/botanjs/src/Astro/Starfall/Element/Footer.js @@ -0,0 +1,2 @@ +// __namespace( "Astro.Starfall.Element.Footer" ); +// __import( "Astro.Common.Element.Footer" ); diff --git a/botanjs/src/Astro/Blog/Element/Header.css b/botanjs/src/Astro/Starfall/Element/Header.css similarity index 100% rename from botanjs/src/Astro/Blog/Element/Header.css rename to botanjs/src/Astro/Starfall/Element/Header.css diff --git a/botanjs/src/Astro/Starfall/Element/Header.js b/botanjs/src/Astro/Starfall/Element/Header.js new file mode 100644 index 0000000..3c369c5 --- /dev/null +++ b/botanjs/src/Astro/Starfall/Element/Header.js @@ -0,0 +1 @@ +// __namespace( "Astro.Starfall.Element.Header" ); diff --git a/botanjs/src/Astro/Blog/Element/Layer.css b/botanjs/src/Astro/Starfall/Element/Layer.css similarity index 100% rename from botanjs/src/Astro/Blog/Element/Layer.css rename to botanjs/src/Astro/Starfall/Element/Layer.css diff --git a/botanjs/src/Astro/Starfall/Element/Layer.js b/botanjs/src/Astro/Starfall/Element/Layer.js new file mode 100644 index 0000000..f3d1daa --- /dev/null +++ b/botanjs/src/Astro/Starfall/Element/Layer.js @@ -0,0 +1 @@ +// __namespace( "Astro.Starfall.Element.Layer" ); diff --git a/botanjs/src/Astro/Starfall/Layout/MainFrame.css b/botanjs/src/Astro/Starfall/Layout/MainFrame.css new file mode 100644 index 0000000..5e1936b --- /dev/null +++ b/botanjs/src/Astro/Starfall/Layout/MainFrame.css @@ -0,0 +1,58 @@ +html, body { height: 100%; } + +html { background-color: #222; } + +body { + background-color: #F0F0F0; + font-family: custom-sans,Helvetica,Arial,STHeiti,"Microsoft JhengHei","微軟正黑體"; +} + +pre { font-family: monospace; } + +::selection { + color: white; + background: purple; +} +::-moz-selection { + color: white; + background: purple; +} + +p { padding: 0.5em; } + +a { + color: #333; + text-decoration: none; +} + +sup { vertical-align: super; } + +a:hover { text-decoration: underline; } + +.clearfix { + clear: both; + padding: 0 !important; + margin: 0 !important; +} + +.begin-wrapper { + position: relative; + + min-height: 100%; + background-color: #EBEAEF; + + overflow: hidden; +} + +.mbody { + position: relative; + width: 100%; +} + +.main-column { + width: 85%; + margin: 0 auto; +} + +.right { text-align: right; } +.panel { padding: 0.5em 1.2em 1.2em 1.2em; } diff --git a/botanjs/src/Astro/Starfall/Layout/MainFrame.js b/botanjs/src/Astro/Starfall/Layout/MainFrame.js new file mode 100644 index 0000000..4926e97 --- /dev/null +++ b/botanjs/src/Astro/Starfall/Layout/MainFrame.js @@ -0,0 +1,61 @@ +(function(){ + var ns = __namespace( "Astro.Starfall.Layout.MainFrame" ); + + /** @type {Dandelion} */ + var Dand = __import( "Dandelion" ); + /** @type {Dandelion.IDOMObject} */ + var IDOMObject = __import( "Dandelion.IDOMObject" ); + /** @type {Dandelion.Window} */ + var wsupp = __import( "Dandelion.Window" ); + /** @type {System.Debug} */ + var debug = __import( "System.Debug" ); + /** @type {Astro.Bootstrap} */ + var Bootstrap = __import( "Astro.Bootstrap" ); + + // __import( "Astro.Starfall.Element.Layer" ); CSS_RESERVATION + + var init = function () + { + console.log( "HERE" ); + // Footer at bottom + var padder = Dand.wrap(); + var begin_wrapper = Dand.id( "begin-wrapper" ); + var content_wrapper = Dand.id( "mbody" ); + var footer = Dand.tag( "footer" ); + var fhorizon = Dand.id( "fhorizon" ); + + if( footer.length ) + { + footer = footer[0]; + var fheight = footer.scrollHeight || footer.offsetHeight; + var hheight = fhorizon.scrollHeight || fhorizon.offsetHeight; + + padder.style.height = ( fheight + hheight ) + "px"; + begin_wrapper.style.marginBottom = "-" + fheight + "px"; + } + + content_wrapper.appendChild( padder ); + + IDOMObject( window ).addEventListener( "Resize", responsify ); + + responsify( null, true ); + }; + + var rspd_ratio = 0; + var responsify = function( e, override ) + { + // Ratio changes would trigger content + var ratio = wsupp.clientWidth / wsupp.clientHeight; + + // Swap only on ration changes from 1 < x OR x < 1 + if( ( ratio < 1.2 && 1.2 < rspd_ratio ) || ( 1.2 < ratio && rspd_ratio < 1.2 ) || override ) + { + rspd_ratio = ratio; + debug.Info( "Responsive Event: R = " + ratio ); + + BotanJS.dispatchEvent( new BotanEvent( "Responsive", { "ratio": ratio } ) ); + } + }; + + Bootstrap.regInit( init ); +})(); diff --git a/botanjs/src/Astro/Blog/Layout/PureColumn.css b/botanjs/src/Astro/Starfall/Layout/PureColumn.css similarity index 100% rename from botanjs/src/Astro/Blog/Layout/PureColumn.css rename to botanjs/src/Astro/Starfall/Layout/PureColumn.css diff --git a/botanjs/src/Astro/Blog/Layout/PureColumn.js b/botanjs/src/Astro/Starfall/Layout/PureColumn.js similarity index 96% rename from botanjs/src/Astro/Blog/Layout/PureColumn.js rename to botanjs/src/Astro/Starfall/Layout/PureColumn.js index ae0e50f..bba67e5 100644 --- a/botanjs/src/Astro/Blog/Layout/PureColumn.js +++ b/botanjs/src/Astro/Starfall/Layout/PureColumn.js @@ -1,5 +1,5 @@ (function(){ - var ns = __namespace( "Astro.Blog.Layout.PureColumn" ); + var ns = __namespace( "Astro.Starfall.Layout.PureColumn" ); /** @type {Astro.Bootstrap} */ var Bootstrap = __import( "Astro.Bootstrap" ); diff --git a/botanjs/src/Astro/Blog/Layout/TwoColumn.css b/botanjs/src/Astro/Starfall/Layout/TwoColumn.css similarity index 100% rename from botanjs/src/Astro/Blog/Layout/TwoColumn.css rename to botanjs/src/Astro/Starfall/Layout/TwoColumn.css diff --git a/botanjs/src/Astro/Blog/Layout/TwoColumn.js b/botanjs/src/Astro/Starfall/Layout/TwoColumn.js similarity index 84% rename from botanjs/src/Astro/Blog/Layout/TwoColumn.js rename to botanjs/src/Astro/Starfall/Layout/TwoColumn.js index 4bffede..24ca689 100644 --- a/botanjs/src/Astro/Blog/Layout/TwoColumn.js +++ b/botanjs/src/Astro/Starfall/Layout/TwoColumn.js @@ -1,5 +1,5 @@ (function(){ - var ns = __namespace( "Astro.Blog.Layout.TwoColumn" ); + var ns = __namespace( "Astro.Starfall.Layout.TwoColumn" ); /** @type {Dandelion} */ var Dand = __import( "Dandelion" ); @@ -12,7 +12,7 @@ if( rspd ) { BotanJS.addEventListener( "Responsive" - /** e @type {Astro.Blog.Events.Responsive} */ + /** e @type {Astro.Starfall.Events.Responsive} */ , function( e ) { rspd.foreach( document.ELEMENT_NODE diff --git a/botanjs/src/Astro/Starfall/_this.js b/botanjs/src/Astro/Starfall/_this.js new file mode 100644 index 0000000..33a5a54 --- /dev/null +++ b/botanjs/src/Astro/Starfall/_this.js @@ -0,0 +1,3 @@ +(function(){ + var ns = __namespace( "Astro.Starfall.Layout" ); +})();