-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(load): add a javascript load queue #159
Conversation
load a javascript load queue
e126b1b
to
4cd105e
Compare
Use lazyload for background image. Now, background image will be shown when the image finished download. This will avoid viewer looking for a picture is downloading in progress. |
顺带把图库的修复了啊🌚🌚 |
<% if(theme.background.bing.enable) { %> | ||
<script type="text/javascript"> | ||
queue.offer(function(){ | ||
$('body').attr("data-original","https://api.i-meto.com/bing?<%= theme.background.bing.parameter %>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use single quotes inside JavaScript code
- Please put a space after comma
|
||
|
||
function offer(element) { | ||
if(this.debug) console.log("Offered a Queued Function."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please user single quote inside JavaScript code (change it for entire file)
- Please surround
if
statement with brackets even for one line, and display it in several lines (change it for entire file)
} | ||
|
||
function execNext() { | ||
var nextfunc=this.poll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please surround
=
by space
|
||
function execNext() { | ||
var nextfunc=this.poll(); | ||
if(nextfunc != undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use strict equality
@@ -84,6 +84,8 @@ | |||
<%- css("css/style.min") %> | |||
<%- partial("_partial/config_css") %> | |||
<%- js("js/jquery.min") %> | |||
<%- js("js/queue") %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use single quotes inside JavaScript code (change it for the entire stack of import)
@@ -15,18 +15,20 @@ | |||
<% if(theme.comment.use == "duoshuo") { %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use strict equality
- Please use single quotes in JavaScript code
Ok, I will fix it as soon as possible. |
@pidupuis I fixed it. Please review. |
What kind of change does this PR introduce? (check one with "x")
Does this PR introduce a breaking change? (check one with "x")
Description
Add a javascript load queue.
You can use
queue.offer(function(){ });
to add a function to load queue and it will automatic called when document DOM finished loading.You can also use this in
head.yml
to use this queue.Now, Bing background and Comment (Disque/Duoshuo) loading using this load queue.
Verification steps
No verification steps.