forked from Botanical/BotanJS
Pure Column
This commit is contained in:
parent
69b43d5b79
commit
f88643cead
@ -39,7 +39,6 @@ h6, .h6 { font-size: 0.5em; }
|
||||
clear: both;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
|
||||
}
|
||||
|
||||
.begin-wrapper {
|
||||
|
18
botanjs/src/Astro/Blog/Layout/PureColumn.css
Normal file
18
botanjs/src/Astro/Blog/Layout/PureColumn.css
Normal file
@ -0,0 +1,18 @@
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
content: "";
|
||||
display: block;
|
||||
}
|
||||
|
||||
.trademark {
|
||||
text-align: right;
|
||||
font-family: custom-sans;
|
||||
}
|
||||
|
||||
.trademark > a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.trademark > a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
76
botanjs/src/Astro/Blog/Layout/PureColumn.js
Normal file
76
botanjs/src/Astro/Blog/Layout/PureColumn.js
Normal file
@ -0,0 +1,76 @@
|
||||
(function(){
|
||||
var ns = __namespace( "Astro.Blog.Layout.PureColumn" );
|
||||
|
||||
/** @type {Astro.Bootstrap} */
|
||||
var Bootstrap = __import( "Astro.Bootstrap" );
|
||||
/** @type {System.Cycle} */
|
||||
var Cycle = __import( "System.Cycle" );
|
||||
/** @type {Astro.Blog.Config} */
|
||||
var config = __import( "Astro.Blog.Config" );
|
||||
/** @type {System.Debug} */
|
||||
var debug = __import( "System.Debug" );
|
||||
|
||||
/** @type {MessageEvent} */
|
||||
var allowedOrigin;
|
||||
|
||||
var catchMessage = function( e )
|
||||
{
|
||||
debug.Info( "Origin: " + e.origin );
|
||||
var allowedOrigins = config.get( "AllowedOrigins" );
|
||||
var j = e.origin;
|
||||
|
||||
for ( var i in allowedOrigins )
|
||||
{
|
||||
if ( j === allowedOrigins[i] )
|
||||
{
|
||||
// Stop listener
|
||||
debug.Info( " captured" );
|
||||
window.removeEventListener( "message", catchMessage, false );
|
||||
allowedOrigin = e;
|
||||
|
||||
// post the content height
|
||||
postContentHeight();
|
||||
return;
|
||||
}
|
||||
}
|
||||
debug.Info( " refused. Continue listening..." );
|
||||
}
|
||||
|
||||
var postContentHeight = function ()
|
||||
{
|
||||
if ( allowedOrigin.source && allowedOrigin.origin )
|
||||
{
|
||||
// per second trigger for body height
|
||||
var pHeight;
|
||||
allowedOrigin.source.postMessage(
|
||||
pHeight = document.body.clientHeight + ""
|
||||
, allowedOrigin.origin
|
||||
);
|
||||
|
||||
var heightUpdate = function()
|
||||
{
|
||||
if( pHeight != document.body.clientHeight )
|
||||
{
|
||||
allowedOrigin.source.postMessage(
|
||||
pHeight = document.body.clientHeight + ""
|
||||
, allowedOrigin.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Cycle.perma( "bodyHeightMonitor", heightUpdate, 500 );
|
||||
}
|
||||
};
|
||||
|
||||
var init = function ()
|
||||
{
|
||||
if ( window.self !== window.top )
|
||||
{
|
||||
debug.Info( "iframe detected, listening ..." );
|
||||
// Wait for parent frame's message
|
||||
window.addEventListener( "message", catchMessage, false );
|
||||
}
|
||||
};
|
||||
|
||||
Bootstrap.regInit( init );
|
||||
})();
|
Loading…
Reference in New Issue
Block a user