practice icon indicating copy to clipboard operation
practice copied to clipboard

Isolate page handlers

Open eush77 opened this issue 10 years ago • 1 comments

Currently each page handler (random, dribble, github) is called on every page. This can lead to bugs (and did so in the past) because some handlers may not work on pages they were not intended for. For example, random and github get some data from .items-notice element which is not present on dribble pages.

With this patch, main.js is changed to call only the handler appropriate to the current page. Alternatively, the initialization code on random and github handlers could be hidden into init function.

I also removed quick fix introduced in https://github.com/tevko/practice/commit/82d73dca250a2835d3505339d8d8e193c2273f7b because it slightly changed the semantics of utils.range (before https://github.com/tevko/practice/commit/82d73dca250a2835d3505339d8d8e193c2273f7b the end was exclusive and the function worked differently if begin>end).

eush77 avatar Oct 04 '15 16:10 eush77

I can't pass linthub check completely: I fixed an issue in dev/js/main.js, but there are also some issues in assets/js/main.min.js such as missing semicolons. This file should probably be ignored somehow.

eush77 avatar Oct 04 '15 17:10 eush77