Skip to content
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

Merged
merged 37 commits into from
Feb 20, 2017
Merged

Fixes and enhancements. [9] #1438

merged 37 commits into from
Feb 20, 2017

Conversation

ivan-nginx
Copy link
Collaborator

@ivan-nginx ivan-nginx commented Feb 17, 2017

PART 1. Some small fixes.

Files modified:

  1. FIX: font family by set global font in config. 7f5b85c
  2. FIX: VK_Like error at not post pages in Fixes and enhancements. [8] #1433. 64cec13
  3. FIX: seo option on page headers. b3a4692

What's this?

  1. This for better appearance without set custom global font style.
  2. In category, archve, tag and custom pages (where likes not loading actually), was error.
  3. Fix headers hierarchy on page headers too.

PART 2. Add external link tag.

Add nonsence for search engines external links tags in Next theme.

Files modified:

  1. ADD: external url decrypt & open script. 1778875
  2. ADD: external url link script option. 1c883c5
  3. ADD: external url option in config. 5da1e72
  4. ADD: external url encrypt script tag. 41c29bc
  5. ADD: external url tag style. 3c1ac4a
  6. ADD: external url css style import. a5320e9
  7. ADD: external url decrypt & open script. [+;] ca52923
  8. ADD: external url encrypt script tag. [+;] da1977b

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:

  1. Replace «a» tag with «span» tag.
  2. Crypt & decrypt url with BASE64. User cannot see base64 format in browser src on this link, it's will be faster to click on this link.
  3. Backlinks by this tag will not be in vision by any monitoring. It's like u open new link with javascript in new tab.
  4. Worked on mobile devices too. Yeap.
  5. This thing is cool for SEO.

How to use?

 Usage: {% exturl text url "title" %}
 Alias: {% extlink text url "title" %}

In any post:

{% exturl Hexo Theme Next https://github.com/iissnan/hexo-theme-next/ %}
{% extlink Google https://google.com "Google without backlink" %}

How it look's?

image


PART 3. Add post #more translate.

Add translate for #more link by the press «Read More» button.

Files modified:

  1. ADD: post «#more» translate label. 915a1e9
  2. ADD: post «#more» default translate. f6e9515
  3. ADD: post «#more» English translate. cd9b9fc
  4. ADD: post «#more» Russian translate. 4679b6f

What's this? How it look's?

image

How to use?

Add in your translate file:

post:
...
  more: your-more-link
...

Will be:
image


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:

  1. ADD: sidebar offset in config. 009e1f5
  2. ADD: sidebar affix offset in variables. 7b9afb3
  3. ADD: sidebar offset option. fad6dfd
  4. ADD: sidebar affix offset option. 34b81a7
  5. FIX: sidebar offset in config. 72747a7
  6. FIX: sidebar affix offset in variables. 3d8381d
  7. FIX: sidebar affix offset option. 7cafdd4
  8. ADD: sidebar affix offset case option. a19c720

What's this? How it look's?

image
image

How to use?

In Next _config.yml:

  # Sidebar offset from top menubar in pixels.
  offset: 12
  offset_float: 12

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:

  1. ADD: b2t in sidebar config. 6068fd9
  2. ADD: b2t in sidebar layot option. f05f35e
  3. ADD: b2t in sidebar option. b93dad8
  4. ADD: b2t in sidebar CSS style. 393e20b
  5. ADD: b2t in sidebar style option. 50e048e
  6. ADD: b2t sidebar hover. c1ac920

What's this? How it look's?

image
image

How to use?

In Next _config.yml:

  # Back to top in sidebar
  b2t: true

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:

  1. ADD: scroll percent in b2t [config]. 1054ec2
  2. ADD: scroll percent in b2t [sidebar]. 7689ab7
  3. ADD: scroll percent in b2t [layout]. 791acec
  4. ADD: scroll percent in b2t [js]. 9a71ac9
  5. FIX: b2t CSS for scrollpercent alignment. 00a50bb
  6. FIX: b2t CSS for scrollpercent alignment [2]. 6a30456
  7. FIX: b2t CSS for scrollpercent alignment [3]. 4d233d7

What's this? How it look's? How to use?

In Next _config.yml:

  # Back to top in sidebar
  b2t: false

  # Scroll percent label in b2t button
  scrollpercent: true

image

OR

  # Back to top in sidebar
  b2t: true

  # Scroll percent label in b2t button
  scrollpercent: true

image


Live demo? Of course.

@iissnan iissnan added this to the v5.1.0 milestone Feb 17, 2017
$(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}}

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).

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}}

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]*))?)/;

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';

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;

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.

@ivan-nginx
Copy link
Collaborator Author

@iissnan ok, it's ready for now.

@iissnan iissnan merged commit f9a59a3 into iissnan:master Feb 20, 2017
@ivan-nginx
Copy link
Collaborator Author

@Acris wow, need to fix it... can u?

@Acris
Copy link
Collaborator

Acris commented Feb 21, 2017

@ivan-nginx It sees to change this to 30px will fix it, but I don't have enough time to test :(

@ivan-nginx
Copy link
Collaborator Author

ivan-nginx commented Feb 21, 2017

@Acris fixed in #1457.


'use strict';

var util = require('hexo-util');
Copy link
Owner

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

Copy link
Collaborator Author

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.

Copy link
Owner

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?

Copy link
Collaborator Author

@ivan-nginx ivan-nginx Mar 11, 2017

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' }

Copy link
Collaborator Author

@ivan-nginx ivan-nginx Mar 11, 2017

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

Copy link
Collaborator Author

@ivan-nginx ivan-nginx Mar 11, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants