Skip to content

Commit

Permalink
完善前端
Browse files Browse the repository at this point in the history
  • Loading branch information
fooleap committed May 15, 2018
1 parent 97c8003 commit bf355af
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/index.html → dist/disqus-php-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Disqus PHP API 示例</title>
<style>
body{
max-width: 640px;
Expand All @@ -28,7 +29,6 @@
forum: 'fooleap',
site: 'http://blog.fooleap.org',
api: 'http://api.fooleap.org/disqus',
url: '/disqus-php-api.html',
mode: 2,
timeout: 3000,
popular: document.getElementById('popular-posts'),
Expand Down
6 changes: 3 additions & 3 deletions dist/iDisqus.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iDisqus.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "disqus-php-api",
"version": "0.2.10",
"version": "0.2.11",
"description": "disqus-php-api 利用 PHP cURL 转发 Disqus API 请求",
"main": "index.js",
"dependencies": {},
Expand All @@ -20,7 +20,7 @@
"webpack-dev-server": "^3.1.4"
},
"scripts": {
"start": "webpack-dev-server --mode development --open",
"start": "webpack-dev-server --mode development",
"dev": "webpack --progress --colors --watch --mode development",
"build": "webpack -p --progress --colors --mode production"
},
Expand Down
2 changes: 1 addition & 1 deletion src/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Disqus PHP API 示例</title>
<style>
body{
max-width: 640px;
Expand All @@ -28,7 +29,6 @@
forum: 'fooleap',
site: 'http://blog.fooleap.org',
api: 'http://api.fooleap.org/disqus',
url: '/disqus-php-api.html',
mode: 2,
timeout: 3000,
popular: document.getElementById('popular-posts'),
Expand Down
13 changes: 7 additions & 6 deletions src/iDisqus.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* v 0.2.10
* v 0.2.11
*
* https://github.com/fooleap/disqus-php-api
*
Expand Down Expand Up @@ -457,7 +457,7 @@
' </div>\n'+
' </div>\n'+
' </div>\n'+
' <div class="comment-form-user">'+ ( _.opts.mode != 1 ? '<div class="comment-form-auth"><button class="comment-form-login" title="使用 Disqus 帐号登录"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 200 200"><path fill="#2E9FFF" d="M102.535 167.5c-16.518 0-31.621-6.036-43.298-16.021L30.5 155.405l11.102-27.401A67.658 67.658 0 0 1 35.564 100c0-37.277 29.984-67.5 66.971-67.5 36.984 0 66.965 30.223 66.965 67.5 0 37.284-29.98 67.5-66.965 67.5zm36.567-67.693v-.188c0-19.478-13.736-33.367-37.42-33.367h-25.58v67.5h25.201c23.868.001 37.799-14.468 37.799-33.945zm-37.138 17.361h-7.482V82.841h7.482c10.989 0 18.283 6.265 18.283 17.07v.188c0 10.896-7.294 17.069-18.283 17.069z"/></svg></button></div><span> 或 </span>' : '' ) + '<div class="comment-form-guest"><input class="comment-form-input comment-form-name" type="text" placeholder="名字(必填)" autocomplete="name"><input class="comment-form-input comment-form-email" type="email" placeholder="邮箱(必填)" autocomplete="email"><input class="comment-form-input comment-form-url" type="url" placeholder="网址(可选)" autocomplete="url"></div></div>\n'+
' <div class="comment-form-user">'+ ( _.opts.mode != 1 ? '<div class="comment-form-auth"><button class="comment-form-login" title="使用 Disqus 帐号登录"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 200 200"><path fill="#2E9FFF" d="M102.535 167.5c-16.518 0-31.621-6.036-43.298-16.021L30.5 155.405l11.102-27.401A67.658 67.658 0 0 1 35.564 100c0-37.277 29.984-67.5 66.971-67.5 36.984 0 66.965 30.223 66.965 67.5 0 37.284-29.98 67.5-66.965 67.5zm36.567-67.693v-.188c0-19.478-13.736-33.367-37.42-33.367h-25.58v67.5h25.201c23.868.001 37.799-14.468 37.799-33.945zm-37.138 17.361h-7.482V82.841h7.482c10.989 0 18.283 6.265 18.283 17.07v.188c0 10.896-7.294 17.069-18.283 17.069z"/></svg></button></div><span> 或 </span>' : '' ) + '<div class="comment-form-guest"><input class="comment-form-input comment-form-name" type="text" name="name" placeholder="名字(必填)" autocomplete="name"><input class="comment-form-input comment-form-email" type="email" name="email" placeholder="邮箱(必填)" autocomplete="email"><input class="comment-form-input comment-form-url" type="url" name="url" placeholder="网址(可选)" autocomplete="url"></div></div>\n'+
' </div>\n'+
' </div>\n'+
' <ul id="comments" class="comment-list"></ul>\n'+
Expand Down Expand Up @@ -716,11 +716,12 @@

_.timeAgo();

if (/^#disqus|^#comment-/.test(location.hash) && !data.cursor.hasPrev && !_.stat.disqusLoaded ) {
if (/^#disqus|^#comment-/.test(location.hash) && !data.cursor.hasPrev && !_.stat.disqusLoaded && !_.stat.loaded) {
var el = _.dom.querySelector('#idisqus ' + location.hash)
window.scrollBy(0, el.getBoundingClientRect().top);
if( !!el ){
window.scrollBy(0, el.getBoundingClientRect().top);
}
}

_.stat.loading = false;
_.stat.loaded = true;
} else if ( data.code === 2 ){
Expand All @@ -732,7 +733,7 @@
);
}

// 读取评 Entrypoint undefined = index.html论
// 读取评论
iDisqus.prototype.load = function(post){

var _ = this;
Expand Down
5 changes: 3 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,17 @@ module.exports = function(env, argv) {
watch: true
}),
new HtmlWebpackPlugin({
title: 'Disqus PHP API',
template: './src/demo.html',
filename: 'disqus-php-api.html',
inject: 'head'
})
],

devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000
port: 9000,
openPage: '/disqus-php-api.html'
}
}
};

0 comments on commit bf355af

Please sign in to comment.