Skip to content

Commit

Permalink
Load all blog entry.
Browse files Browse the repository at this point in the history
Add the function that load all blog entries.
  • Loading branch information
garafu committed Apr 27, 2014
1 parent 586c7e7 commit e97a353
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ User setting should be placed before the concreate script file.
// User Setting.
var POSTSTOC_SETTINGS = {
blogURL: 'garafu.blogspot.jp', // Set your blog url.
maxResults: 500, // Set max recieve data.
maxResults: 500, // Set max recieve data. If set 'Infinity', you can recieve all entries.
orderby: 'updated', // Set enum ['title', 'published', 'updated'].
printby: 'title' // Set enum ['title', 'label']
};
Expand Down
4 changes: 3 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ set OUTPUT_FILE=.\build\blogger.toc.min.js
--compiler_flags="--externs=%CONTRACT_JS%" ^
--compiler_flags="--js_output_file=%OUTPUT_FILE%"


rem for debug options.
rem --compiler_flags="--compilation_level=WHITESPACE_ONLY" ^
rem --compiler_flags="--formatting=pretty_print" ^

rem --root=%CLOSERU_LIBRARY_THIRD_DIR% ^
rem --compiler_flags="--formatting=print_input_delimiter" ^
Expand Down
8 changes: 4 additions & 4 deletions build/blogger.toc.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion demo/index_compile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<script type="text/javascript">
var POSTSTOC_SETTINGS = {
blogURL: 'garafu.blogspot.jp',
maxResults: 500,
orderby: 'published',
printby: 'title'
};
Expand Down
1 change: 0 additions & 1 deletion demo/index_nocompile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<script type="text/javascript">
var POSTSTOC_SETTINGS = {
blogURL: 'garafu.blogspot.jp',
maxResults: 500,
orderby: 'title',
printby: 'label'
};
Expand Down
Binary file modified lib/closure-library/closure/bin/build/depstree.pyc
Binary file not shown.
Binary file modified lib/closure-library/closure/bin/build/jscompiler.pyc
Binary file not shown.
Binary file modified lib/closure-library/closure/bin/build/source.pyc
Binary file not shown.
Binary file modified lib/closure-library/closure/bin/build/treescan.pyc
Binary file not shown.
13 changes: 8 additions & 5 deletions src/blogger/toc/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ garafu.blogger.toc.Main.load = function (data) {
// Get singleton instance.
self = garafu.blogger.toc.Main.getInstance();

// Merge recieved data.
// Merge rcieved data.
if (!garafu.blogger.toc.Main._data) {
garafu.blogger.toc.Main._data = data;
} else {
} else if (data.feed.entry && data.feed.entry.length != 0) {
origin = garafu.blogger.toc.Main._data.feed.entry;
additional = data.feed.entry;
merged = origin.concat(additional);
garafu.blogger.toc.Main._data.feed.entry = merged;
}

// Whether need to additional request.
if (!self.isAllReceived()) {
if (!self.isAllReceived(data)) {
// Request additional data.
self.request();
} else {
Expand Down Expand Up @@ -155,10 +155,13 @@ garafu.blogger.toc.Main.getInstance = function () {
* Get the value indicating whether the all feed data has been recieved or not.
*
* @public
* @param {object} Recieved data.
* @return {boolean} The value indicating whether the all feed data has been recieved.
*/
garafu.blogger.toc.Main.prototype.isAllReceived = function () {
return this._settings.maxResults <= this.requestedCount;
garafu.blogger.toc.Main.prototype.isAllReceived = function (data) {
return (this._settings.maxResults <= this.requestedCount ||
!data.feed.entry ||
(data.feed.entry && data.feed.entry.length === 0))
};


Expand Down
2 changes: 1 addition & 1 deletion src/blogger/toc/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ garafu.blogger.toc.Settings = function () {

// Default settings.
this.blogURL = this.getValueOrDefault(user['blogURL'], 'garafu.blogspot.jp');
this.maxResults = this.getValueOrDefault(user['maxResults'], 500);
this.maxResults = this.getValueOrDefault(user['maxResults'], Infinity);
this.style = this.getValueOrDefault(user['style'], '');
this.orderby = this.getValueOrDefault(user['orderby'], 'published');
this.printby = this.getValueOrDefault(user['printby'], 'label');
Expand Down

0 comments on commit e97a353

Please sign in to comment.