-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fixes and enhancements. [9] #1438
Conversation
source/js/src/exturl.js
Outdated
$(document).ready(function () { | ||
|
||
// Create Base64 Object | ||
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} |
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.
Line is too long.
Identifier '_utf8_encode' is not in camel case.
Unexpected use of '>>'.
Unexpected use of '&'.
Unexpected use of '<<'.
Unexpected use of '|'.
Missing semicolon.
Identifier '_utf8_decode' is not in camel case.
You might be leaking a variable (c1) here.
Too many errors. (37% scanned).
scripts/tags/exturl.js
Outdated
var rUrl = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)/; | ||
|
||
// Create Base64 Object | ||
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} |
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.
Line is too long.
Mixed double and single quotes.
Identifier '_utf8_encode' is not in camel case.
Unexpected use of '>>'.
Unexpected use of '&'.
Unexpected use of '<<'.
Unexpected use of '|'.
Missing semicolon.
Identifier '_utf8_decode' is not in camel case.
Too many errors. (22% scanned).
var util = require('hexo-util'); | ||
var htmlTag = util.htmlTag; | ||
|
||
var rUrl = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)/; |
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.
Line is too long.
// Usage: {% exturl text url "title" %} | ||
// Alias: {% extlink text url "title" %} | ||
|
||
'use strict'; |
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.
Use the function form of "use strict".
function initAffix () { | ||
var headerHeight = $('.header-inner').height(); | ||
var footerOffset = parseInt($('.main').css('padding-bottom'), 10); | ||
var sidebarTop = headerHeight + 10; | ||
var sidebarTop = (CONFIG.sidebar.offset_float === 0) ? headerHeight + CONFIG.sidebar.offset : headerHeight; |
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.
Identifier 'offset_float' is not in camel case.
@iissnan ok, it's ready for now. |
@Acris wow, need to fix it... can u? |
@ivan-nginx It sees to change this to 30px will fix it, but I don't have enough time to test :( |
|
||
'use strict'; | ||
|
||
var util = require('hexo-util'); |
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.
@ivan-nginx It seems the hexo-util
module resolution would be failed if user didn't install it via npm install
command. That is to say, it is required to install hexo-util
module in order to use the exturl
tag? Issue #1490
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.
@iissnan «external link» tag work like standart «link» tag in hexo tag plugins:
https://hexo.io/docs/tag-plugins.html#Link
https://github.com/hexojs/hexo/blob/master/lib/plugins/tag/link.js
So, if standart tags need dependiens for hexo-util, this «external link» tag need it too.
But, i don't install anything from last year and standart «link» tag worked fine as «external link» tag too.
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.
Do you have the hexo-util
installed under node_modules
directory?
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.
@iissnan em, yes. It was there always. Under node_modules
.
And i think need to check NPM and/or nodeJS version about that. My version still 0.10:
$ npm version
{ http_parser: '1.2',
node: '0.10.48',
v8: '3.14.5.11',
ares: '1.9.0-DEV',
uv: '0.10.34',
zlib: '1.2.3',
modules: '11',
openssl: '1.0.1e-fips',
npm: '1.3.6',
'hexo-site': '0.0.0' }
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.
@iissnan ok, check this: https://github.com/hexojs/hexo-util
I don't remember for now, but possibly i was install it together with hexo.
Directory hexo-util
have same install data with directory hexo
. But, in standart plugins (https://hexo.io/plugins/) hexo-util
not present.
Anyway, if this issue present, need to recommend peoples install this utilities?
$ npm install hexo-util --save
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.
Ok, i just reproducte base install with it. In main node_modules
dir there is no hexo-util
module.
I think need to use some global var of hexo node_modules
but can't find it for now.
Also, some bug was find, i try to fix it soon.
Fixes and enhancements. [9]
PART 1. Some small fixes.
Files modified:
What's this?
PART 2. Add external link tag.
Add nonsence for search engines external links tags in Next theme.
Files modified:
What's this?
Ok, let's see. Search engines scanned «a» tag anyway. U may set
external
or any things, but your links will be indexed anyway. But they does't do any javascript, it's do clients on their local devices.This tag give the way by set any external link without «a» tag and any additional info about external resource. This do:
How to use?
In any post:
How it look's?
PART 3. Add post
#more
translate.Add translate for
#more
link by the press «Read More» button.Files modified:
What's this? How it look's?
How to use?
Add in your translate file:
Will be:

PART 4. Add sidebar offset option.
Add 2 vars to offset from top menubar on sidebar & sidebar affix (when post is scroll down).
Files modified:
What's this? How it look's?
How to use?
In Next
_config.yml
:PART 5. Add back to top in sidebar option.
Replace default back-to-top arrow by same b2t in sidebar on all posts/pages (on main sidebar and on TOC too).
Files modified:
What's this? How it look's?
How to use?
In Next
_config.yml
:PART 6. Add vertical scroll percent label option.
Add to your layout or sidebar back to top botton percent label of vertical site scroll.
Files modified:
What's this? How it look's? How to use?
In Next
_config.yml
:OR
Live demo? Of course.