-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better independence of Artalk instance & Add some examples.
- Loading branch information
Showing
26 changed files
with
336 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Multiple Artalk On One Page Example</title> | ||
<!-- 1. 引入 Artalk.css --> | ||
<link rel="stylesheet" href="/dist/Artalk.css"> | ||
</head> | ||
<body> | ||
|
||
<h1>Multiple Artalk On One Page Example</h1> | ||
|
||
<div class="main"> | ||
<h2>Artalk One</h2> | ||
<div id="ArtalkComments-1"></div> | ||
|
||
<h2>Artalk Two</h2> | ||
<div id="ArtalkComments-2"></div> | ||
</div> | ||
|
||
<!-- 2. 引入 Artalk.js --> | ||
<script src="/dist/Artalk.js"></script> | ||
<!-- 3. 配置 Artalk --> | ||
<script> | ||
(function () { | ||
// 公用配置 | ||
const commonConf = { | ||
placeholder: '来啊,快活啊 ( ゜- ゜)', | ||
noComment: '快来成为第一个评论的人吧~', | ||
defaultAvatar: 'mp', | ||
serverUrl: 'http://localhost:23366/', | ||
readMore: { | ||
pageSize: 15, | ||
autoLoad: true | ||
} | ||
} | ||
|
||
// 第一个评论 | ||
new Artalk({ | ||
el: '#ArtalkComments-1', | ||
pageKey: 'multiple-on-one-page-1', | ||
...commonConf | ||
}) | ||
|
||
// 第二个评论 | ||
new Artalk({ | ||
el: '#ArtalkComments-2', | ||
pageKey: 'multiple-on-one-page-2', | ||
...commonConf | ||
}) | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Artalk Normal Example</title> | ||
<!-- 1. 引入 Artalk.css --> | ||
<link rel="stylesheet" href="/dist/Artalk.css"> | ||
</head> | ||
<body> | ||
|
||
<h1>Artalk Normal Example</h1> | ||
|
||
<div class="main"> | ||
<div id="ArtalkComments"></div> | ||
</div> | ||
|
||
<!-- 2. 引入 Artalk.js --> | ||
<script src="/dist/Artalk.js"></script> | ||
<!-- 3. 配置 Artalk --> | ||
<script> | ||
var artalk = new Artalk({ | ||
el: '#ArtalkComments', // 元素选择 | ||
placeholder: '来啊,快活啊 ( ゜- ゜)', // 占位符 | ||
noComment: '快来成为第一个评论的人吧~', // 无评论时显示 | ||
defaultAvatar: 'mp', // 参考 https://cn.gravatar.com/site/implement/images/#default-image | ||
pageKey: 'Artalk Normal Example', | ||
serverUrl: 'http://localhost:23366/', | ||
readMore: { // 阅读更多配置 | ||
pageSize: 15, // 每次请求获取评论数 | ||
autoLoad: true // 滚动到底部自动加载 | ||
} | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Artalk Pjax Example</title> | ||
<!-- 1. 引入 Artalk.css --> | ||
<link rel="stylesheet" href="/dist/Artalk.css"> | ||
</head> | ||
<body> | ||
<h1>Artalk Pjax Example</h1> | ||
<div> | ||
Go to <a href="./res1.html">第一页</a> | <a href="./res2.html">第二页</a> | ||
</div> | ||
<div id="container"></div> | ||
</body> | ||
|
||
<!-- 2. 引入 Artalk.js --> | ||
<script src="/dist/Artalk.js"></script> | ||
|
||
<!-- Pjax 配置 --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.pjax.min.js"></script> | ||
<script type="text/javascript"> | ||
$(document).pjax('a', '#container', { | ||
fragment: '.main' // △ 提取 AJAX 响应内容中指定的元素内容片段;参考:http://bsify.admui.com/jquery-pjax/ | ||
}) | ||
</script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Res</title> | ||
<!-- 1. 引入 Artalk.css --> | ||
<link rel="stylesheet" href="/dist/Artalk.css"> | ||
</head> | ||
<body> | ||
|
||
<div class="main"> <!-- △ fragment: .main --> | ||
<section id="comments"> | ||
<div id="ArtalkComments"></div> | ||
</section> | ||
|
||
<!-- 2. 引入 Artalk.js --> | ||
<script src="/dist/Artalk.js"></script> | ||
<!-- 3. 配置 Artalk --> | ||
<script> | ||
window.artalk = new Artalk({ | ||
el: '#ArtalkComments', | ||
placeholder: '来啊,快活啊 ( ゜- ゜)', | ||
noComment: '快来成为第一个评论的人吧~', | ||
defaultAvatar: 'mp', | ||
pageKey: 'pjax-example-page1', | ||
serverUrl: 'http://localhost:23366/index.php', | ||
readMore: { | ||
pageSize: 15, | ||
autoLoad: true | ||
} | ||
}); | ||
</script> | ||
|
||
</div> | ||
|
||
<!-- Pjax 配置 --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.pjax.min.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Res</title> | ||
<!-- 1. 引入 Artalk.css --> | ||
<link rel="stylesheet" href="/dist/Artalk.css"> | ||
</head> | ||
<body> | ||
|
||
<div class="main"> <!-- △ fragment: .main --> | ||
<section id="comments"> | ||
<div id="ArtalkComments"></div> | ||
</section> | ||
|
||
<!-- 2. 引入 Artalk.js --> | ||
<script src="/dist/Artalk.js"></script> | ||
<!-- 3. 配置 Artalk --> | ||
<script> | ||
window.artalk = new Artalk({ | ||
el: '#ArtalkComments', | ||
placeholder: '来啊,快活啊 ( ゜- ゜)', | ||
noComment: '快来成为第一个评论的人吧~', | ||
defaultAvatar: 'mp', | ||
pageKey: 'pjax-example-page2', | ||
serverUrl: 'http://localhost:23366/index.php', | ||
readMore: { | ||
pageSize: 15, | ||
autoLoad: true | ||
} | ||
}); | ||
</script> | ||
|
||
</div> | ||
|
||
<!-- Pjax 配置 --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.pjax.min.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "artalk", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "一款简洁有趣的自托管评论系统", | ||
"author": "qwqcode <[email protected]> (https://github.com/qwqcode)", | ||
"keywords": [ | ||
|
@@ -55,6 +55,7 @@ | |
"eslint-plugin-prettier": "^3.1.0", | ||
"gh-pages": "^2.1.1", | ||
"hanabi": "^0.4.0", | ||
"html-webpack-harddisk-plugin": "^1.0.1", | ||
"html-webpack-plugin": "^3.2.0", | ||
"less": "^3.11.1", | ||
"less-loader": "^6.0.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import Artalk, { ArtalkInstance } from './Artalk' | ||
import Artalk from './Artalk' | ||
|
||
export default class ArtalkContext { | ||
protected artalk: Artalk = ArtalkInstance | ||
public artalk: Artalk | ||
|
||
public constructor (artalk: Artalk) { | ||
this.artalk = artalk | ||
} | ||
} |
Oops, something went wrong.