Reduced some image 301 round trips

This commit is contained in:
2022-04-05 18:13:40 +09:00
parent ec55e174db
commit 16f112485a
23 changed files with 92 additions and 48 deletions

View File

@@ -49,7 +49,7 @@
}
textarea.v_snippet_input {
font-family: monospace;
font-family: site-mono;
font-size: 1em;
}

View File

@@ -1,14 +1,14 @@
.site_file[data-type="album"] {
.site-file[data-type="album"] {
column-width: 225px;
column-gap: 0.75em;
}
.site_file[data-type="album"] > div {
.site-file[data-type="album"] > div {
display: inline-block;
margin-bottom: 0.5em;
width: 100%;
}
.site_file[data-type="album"] > div img {
.site-file[data-type="album"] > div img {
width: 100%;
}

View File

@@ -64,11 +64,9 @@
Cycle.next( function()
{
new SiteFile( this.id, this.hash );
}.bind({ id: uuid, hash: file.hash }) );
new SiteFile( this.id, this.info.hash, this.info );
}.bind({ id: uuid, info: file }) );
}
console.log( finfo );
};
var loadFailed = function( obj )

View File

@@ -4,7 +4,7 @@
}
.inline-code {
font-family: monospace;
font-family: site-mono;
font-size: 1.12em;
color: black;

View File

@@ -20,7 +20,7 @@
/** @type {_AstConf_.SiteFile} */
var config = null;
var SiteFile = function ( id, hash )
var SiteFile = function ( id, hash, nObj )
{
if( !config ) throw new Error( "config is not defined" );
// TODO: Make a trigger for downloading from server
@@ -38,9 +38,14 @@
if( stage.getAttribute( "noauto" ) != null ) return this;
var applyStructure = function( obj )
{
return _applyStructure( JSON.parse( obj ).file );
};
var _applyStructure = function( obj )
{
/** @type {_AstJson_.SiteFile} */
var finfo = JSON.parse( obj ).file;
var finfo = obj;
switch( finfo.type )
{
@@ -50,16 +55,16 @@
switch( IDOMElement(stage).getDAttribute('size') )
{
case "small":
node.src = config.path.image.small + hash + '.jpg';
node.src = finfo.thumbs.small || ( config.path.image.small + hash + '.jpg' );
break;
case "medium":
node.src = config.path.image.medium + hash + '.jpg';
node.src = finfo.thumbs.medium || ( config.path.image.medium + hash + '.jpg' );
break;
case "original":
node.src = config.path.image.original + hash + '.jpg';
break;
default: // large
node.src = config.path.image.large + hash + '.jpg';
node.src = finfo.thumbs.large || ( config.path.image.large + hash + '.jpg' );
}
stage.appendChild(Dand.wrapne(
@@ -134,7 +139,14 @@
stage.appendChild( Dand.wrapc( "sf_failed", Dand.textNode( "Error: Failed to get resources info" ) ) );
};
this.loadInfo( applyStructure, loadFailed );
if( nObj )
{
_applyStructure( nObj );
}
else
{
this.loadInfo( applyStructure, loadFailed );
}
};
SiteFile.prototype.loadInfo = function( success, failed )

View File

@@ -40,7 +40,7 @@
/*{{{ Global Element Styles */
pre {
font-family: monospace;
font-family: site-mono;
}
textarea, input, div[contentEditable="true"], select {

View File

@@ -1,5 +1,5 @@
.build-list > a {
font-family: monospace;
font-family: site-mono;
display: block;

View File

@@ -21,7 +21,7 @@
.build-status > * .failed { color: darkred; }
.build-commit-message {
font-family: monospace;
font-family: site-mono;
padding: 0.2em 0;
}

View File

@@ -1,9 +1,9 @@
.site-news { font-family: monospace; }
.site-news { font-family: site-mono; }
.site-news > span { display: block; }
.rbuilds > a {
display: block;
font-family: monospace;
font-family: site-mono;
}
.rbuilds > a > span {
padding: 0 0.5em;

View File

@@ -7,7 +7,7 @@ body {
font-family: custom-sans,Helvetica,Arial,STHeiti,"Microsoft JhengHei","微軟正黑體";
}
pre { font-family: monospace; }
pre { font-family: site-mono; }
::selection {
color: white;
@@ -32,7 +32,7 @@ a {
}
textarea {
font-family: monospace;
font-family: site-mono;
}
sup { vertical-align: super; }

View File

@@ -1,5 +1,5 @@
h4 { font-family: custom-sans; }
h5, h6 { font-family: monospace; }
h5, h6 { font-family: site-mono; }
h4 { font-size: 1.5em; }
h5 { font-size: 1.3em; }
h6 { font-size: 1.1em; }

View File

@@ -7,7 +7,7 @@ body {
font-family: custom-sans,Helvetica,Arial,STHeiti,"Microsoft JhengHei","微軟正黑體";
}
pre { font-family: monospace; }
pre { font-family: site-mono; }
::selection {
color: white;