Skip to content

Fixes and enhancements. [10]#1574

Merged
iissnan merged 12 commits intoiissnan:masterfrom
ivan-nginx:master
Apr 9, 2017
Merged

Fixes and enhancements. [10]#1574
iissnan merged 12 commits intoiissnan:masterfrom
ivan-nginx:master

Conversation

@ivan-nginx
Copy link
Copy Markdown
Collaborator

@ivan-nginx ivan-nginx commented Apr 7, 2017

PART 1. Some small fixes.

Files modified:

  1. UPD: ru language. 2eee68f
  2. FIX: scroll percent now count only content div. 4bd315d

What's this?

  1. Update russian language for feat: add the configure for declare copyright on posts #1497.
  2. Scroll percent count only post content (without comments iframe preloading, for ex.).

PART 2. Add save_scroll option.

Option for saving vertical scroll position on each post/page in cookies.

Files modified:

  1. ADD: save_scroll option in config. 16f97aa
  2. ADD: save_scroll option in layout. c858f8e
  3. ADD: save_scroll option in third-party. [bridge] 29b94d3
  4. ADD: save_scroll API script (js.cookie v2.1.4). 94287c5
  5. FIX: save_scroll main script file. [4] 0070675

How to use?

In Next _config.yml:

# Automatically saving scroll position on each post/page in cookies.
save_scroll: true

@@ -0,0 +1,25 @@
/* global NexT: true */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'NexT' is defined but never used.


// Read position from cookie
if (Cookies.get('scroll-cookie') !== undefined) {
var cvalues = Cookies.get('scroll-cookie').split('|');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

});

// Read position from cookie
if (Cookies.get('scroll-cookie') !== undefined) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

$(window).on('scroll', function() {
clearTimeout(timeout);
timeout = setTimeout(function () {
Cookies.set('scroll-cookie', ($(window).scrollTop() + '|' + rpath), { path: '' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.


// Write position in cookie
var timeout;
$(window).on('scroll', function() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.


key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'escape' is not defined.

registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined.

;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'define' is not defined.

*/
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'define' is not defined.

var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.

@@ -0,0 +1,25 @@
/* global NexT: true */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'NexT' is defined but never used.


// Read position from cookie
if (Cookies.get('scroll-cookie') !== undefined) {
var cvalues = Cookies.get('scroll-cookie').split('|');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

});

// Read position from cookie
if (Cookies.get('scroll-cookie') !== undefined) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

$(window).on('scroll', function() {
clearTimeout(timeout);
timeout = setTimeout(function () {
Cookies.set('scroll-cookie', ($(window).scrollTop() + '|' + rpath), { path: '' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.


// Write position in cookie
var timeout;
$(window).on('scroll', function() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.


key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'escape' is not defined.

registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined.

;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'define' is not defined.

*/
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'define' is not defined.

var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.

@@ -0,0 +1,25 @@
/* global NexT: true */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'NexT' is defined but never used.


// Read position from cookie
if (Cookies.get('scroll-cookie') !== undefined) {
var cvalues = Cookies.get('scroll-cookie').split('|');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

});

// Read position from cookie
if (Cookies.get('scroll-cookie') !== undefined) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

$(window).on('scroll', function() {
clearTimeout(timeout);
timeout = setTimeout(function () {
Cookies.set('scroll-cookie', ($(window).scrollTop() + '|' + rpath), { path: '' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.


// Write position in cookie
var timeout;
$(window).on('scroll', function() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.


key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'escape' is not defined.

registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined.

;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'define' is not defined.

*/
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'define' is not defined.

var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.

});

// Read position from cookie
if (Cookies.get("scroll-cookie") !== undefined) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Cookies' is not defined.


// Read position from cookie
if (Cookies.get("scroll-cookie") !== undefined) {
var cvalues = Cookies.get('scroll-cookie').split('|');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

$(window).on("scroll", function() {
clearTimeout(timeout);
timeout = setTimeout(function () {
Cookies.set('scroll-cookie', ($(window).scrollTop() + '|' + rpath), { path: '' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

@@ -0,0 +1,23 @@
$(document).ready(function() {

// Set relative link path (without domain): https://stackoverflow.com/questions/3955959/whats-an-easy-way-to-get-the-url-in-the-current-window-minus-the-domain-name
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.

$(window).on("scroll", function() {
clearTimeout(timeout);
timeout = setTimeout(function () {
Cookies.set("scroll-cookie", ($(window).scrollTop() + '|' + rpath), { path: '' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

$(window).on("scroll", function() {
clearTimeout(timeout);
timeout = setTimeout(function () {
Cookies.set("scroll-cookie", ($(window).scrollTop() + '|' + rpath), { path: '' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.
'Cookies' is not defined.

@iissnan iissnan merged commit 9334f79 into iissnan:master Apr 9, 2017
@iissnan
Copy link
Copy Markdown
Owner

iissnan commented Apr 9, 2017

Thanks. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants