Pure Column

This commit is contained in:
斟酌 鵬兄 2015-08-15 01:13:54 +08:00
parent 69b43d5b79
commit f88643cead
3 changed files with 94 additions and 1 deletions

View File

@ -39,7 +39,6 @@ h6, .h6 { font-size: 0.5em; }
clear: both;
padding: 0 !important;
margin: 0 !important;
}
.begin-wrapper {

View 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;
}

View 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 );
})();