Private GIT

Skip to content
Snippets Groups Projects
Commit b5ae6efb authored by Alexis Tyler's avatar Alexis Tyler Committed by GitHub
Browse files

Merge pull request #3923 from SickRage/lint-js_libs

Lint js libs
parents b7eb8057 06f90be9
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,6 @@ install: ...@@ -65,7 +65,6 @@ install:
- set PATH=%APPDATA%\npm;%PATH% - set PATH=%APPDATA%\npm;%PATH%
- npm -g install xo - npm -g install xo
- npm install --quiet - npm install --quiet
- bower install
test_script: test_script:
- xo - xo
......
This diff is collapsed.
//** Scrolling HTML Bookmarks script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com. /* Scrolling HTML Bookmarks script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com/ (April 11th, 09') * Available/ usage terms at http://www.dynamicdrive.com/ (April 11th, 09')
//** Updated Nov 10th, 09'- Fixed anchor jumping issue in IE7 */
var bookmarkscroll = { var bookmarkscroll = {
setting: {duration:1000, yoffset:-50}, //{duration_of_scroll_milliseconds, offset_from_target_element_to_rest} setting: {
topkeyword: '#top', //keyword used in your anchors and scrollTo() to cause script to scroll page to very top duration: 1000,
yoffset: -50
scrollTo:function(dest, options, hash){ },
var $=jQuery, options=options || {} topkeyword: '#top', // Keyword used in your anchors and scrollTo() to cause script to scroll page to very top
var $dest=(typeof dest=="string" && dest.length>0)? (dest==this.topkeyword? 0 : $('#'+dest)) : (dest)? $(dest) : [] //get element based on id, topkeyword, or dom ref scrollTo: function(dest, options) {
if ($dest===0 || $dest.length==1 && (!options.autorun || options.autorun && Math.abs($dest.offset().top+(options.yoffset||this.setting.yoffset)-$(window).scrollTop())>5)){ const $ = jQuery;
this.$body.animate({scrollTop: ($dest===0)? 0 : $dest.offset().top+(options.yoffset||this.setting.yoffset)}, (options.duration||this.setting.duration), function(){ options = options || {};
//** if ($dest!==0 && hash) const $dest = (typeof dest === 'string' && dest.length > 0) ? (dest === this.topkeyword ? 0 : $('#' + dest)) : (dest) ? $(dest) : []; // Get element based on id, topkeyword, or dom ref
//** location.hash=hash if ($dest === 0 || $dest.length === 1 && (!options.autorun || options.autorun && Math.abs($dest.offset().top + (options.yoffset || this.setting.yoffset) - $(window).scrollTop()) > 5)) { // eslint-disable-line no-mixed-operators
}) this.$body.animate({
scrollTop: ($dest === 0) ? 0 : $dest.offset().top + (options.yoffset || this.setting.yoffset)
}, (options.duration || this.setting.duration));
} }
}, },
urlparamselect: function() { urlparamselect: function() {
var param=window.location.search.match(/scrollto=[\w\-_,]+/i) //search for scrollto=divid var param = window.location.search.match(/scrollto=[\w\-_,]+/i); // Search for scrollto=divid
return (param)? param[0].split('=')[1] : null return (param) ? param[0].split('=')[1] : null;
}, },
init: function() { init: function() {
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
var mainobj=bookmarkscroll const mainobj = bookmarkscroll;
mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') mainobj.$body = (window.opera) ? (document.compatMode === 'CSS1Compat' ? $('html') : $('body')) : $('html,body');
var urlselectid=mainobj.urlparamselect() //get div of page.htm?scrollto=divid
if (urlselectid) //if id defined // Get div of page.htm?scrollto=divid
setTimeout(function(){mainobj.scrollTo(document.getElementById(urlselectid) || $('a[name='+urlselectid+']:eq(0)').get(0), {autorun:true})}, 100) const urlselectid = mainobj.urlparamselect();
$('a[href^="#"]').each(function(){ //loop through links with "#" prefix // If id defined
var hashvalue=this.getAttribute('href').match(/#\w+$/i) //filter links at least 1 character following "#" prefix if (urlselectid) {
hashvalue=(hashvalue)? hashvalue[0].substring(1) : null //strip "#" from hashvalue setTimeout(function() {
if (this.hash.length>1){ //if hash value is more than just "#" mainobj.scrollTo(document.getElementById(urlselectid) || $('a[name=' + urlselectid + ']:eq(0)').get(0), {
var $bookmark=$('a[name='+this.hash.substr(1)+']:eq(0)') autorun: true
if ($bookmark.length==1 || this.hash==mainobj.topkeyword){ //if HTML anchor with given ID exists or href==topkeyword });
if ($bookmark.length==1 && !document.all) //non IE, or IE7+ }, 100);
$bookmark.html('.').css({position:'absolute', fontSize:1, visibility:'hidden'}) }
$(this).on('click', function(e){ // Loop through links with "#" prefix
mainobj.scrollTo((this.hash==mainobj.topkeyword)? mainobj.topkeyword : $bookmark.get(0), {}, this.hash) $('a[href^="#"]').each(function() {
e.preventDefault() // If hash value is more than just "#"
}) if (this.hash.length > 1) {
const $bookmark = $('a[name=' + this.hash.substr(1) + ']:eq(0)');
// If HTML anchor with given ID exists or href==topkeyword
if ($bookmark.length === 1 || this.hash === mainobj.topkeyword) {
// Non IE, or IE7+
if ($bookmark.length === 1 && !document.all) {
$bookmark.html('.').css({position: 'absolute', fontSize: 1, visibility: 'hidden'});
} }
$(this).click(function(event) {
mainobj.scrollTo((this.hash === mainobj.topkeyword) ? mainobj.topkeyword : $bookmark.get(0), {}, this.hash);
event.preventDefault();
});
} }
})
})
} }
});
});
} }
};
bookmarkscroll.init() bookmarkscroll.init();
\ No newline at end of file
//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com. /* JQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09') * Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'): */
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera.
const scrolltotop = {
var scrolltotop={ // Startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
// scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). // scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]}, setting: {
controlHTML: topImageHtml, startline: 100,
controlattrs: {offsetx:10, offsety:10}, //offset of control relative to right/ bottom of window corner scrollto: 0,
scrollduration: 1000,
fadeduration: [500, 100]
},
controlHTML: topImageHtml, // eslint-disable-line no-undef
// Offset of control relative to right/bottom of window corner
controlattrs: {
offsetx: 10,
offsety: 10
},
anchorkeyword: '#top', // Enter href value of HTML anchors on the page that should also act as "Scroll Up" links anchorkeyword: '#top', // Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
state: {isvisible: false, shouldvisible: false}, state: {isvisible: false, shouldvisible: false},
scrollup: function() { scrollup: function() {
if (!this.cssfixedsupport) { //if control is positioned using JavaScript // If control is positioned using JavaScript
this.$control.css({opacity:0}); //hide control immediately after clicking it if (!this.cssfixedsupport) {
// Hide control immediately after clicking it
this.$control.css({
opacity: 0
});
} }
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto); let dest = isNaN(this.setting.scrollto) ? this.setting.scrollto : parseInt(this.setting.scrollto, 10);
if (typeof dest === "string" && jQuery('#'+dest).length === 1){ //check element set by string exists if (typeof dest === 'string' && jQuery('#' + dest).length === 1) { // Check element set by string exists
dest = jQuery('#' + dest).offset().top; dest = jQuery('#' + dest).offset().top;
} else { } else {
dest = 0; dest = 0;
} }
this.$body.animate({scrollTop: dest}, this.setting.scrollduration); this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
}, },
keepfixed: function() { keepfixed: function() {
var $window=jQuery(window); const $window = jQuery(window);
var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx; const controlx = $window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx;
var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety; const controly = $window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety;
this.$control.css({left: controlx + 'px', top: controly + 'px'}); this.$control.css({left: controlx + 'px', top: controly + 'px'});
}, },
togglecontrol: function() { togglecontrol: function() {
var scrolltop=jQuery(window).scrollTop(); const scrolltop = jQuery(window).scrollTop();
if (!this.cssfixedsupport) { if (!this.cssfixedsupport) {
this.keepfixed(); this.keepfixed();
} }
this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false; this.state.shouldvisible = (scrolltop >= this.setting.startline);
if (this.state.shouldvisible && !this.state.isvisible) { if (this.state.shouldvisible && !this.state.isvisible) {
this.$control.stop().animate({opacity: 1}, this.setting.fadeduration[0]); this.$control.stop().animate({opacity: 1}, this.setting.fadeduration[0]);
this.state.isvisible = true; this.state.isvisible = true;
...@@ -49,27 +55,40 @@ var scrolltotop={ ...@@ -49,27 +55,40 @@ var scrolltotop={
this.state.isvisible = false; this.state.isvisible = false;
} }
}, },
init: function() { init: function() {
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
var mainobj = scrolltotop; const mainobj = scrolltotop;
var iebrws = document.all; const iebrws = document.all;
mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode.toLowerCase() === "CSS1Compat".toLowerCase() && window.XMLHttpRequest; //not IE or IE7+ browsers in standards mode
mainobj.$body=(window.opera)? (document.compatMode.toLowerCase() === "CSS1Compat".toLowerCase() ? $('html') : $('body')) : $('html,body'); // Not IE or IE7+ browsers in standards mode
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>') mainobj.cssfixedsupport = !iebrws || iebrws && document.compatMode.toLowerCase() === 'CSS1Compat'.toLowerCase() && window.XMLHttpRequest; // eslint-disable-line no-mixed-operators
.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'}) mainobj.$body = (window.opera) ? (document.compatMode.toLowerCase() === 'CSS1Compat'.toLowerCase() ? $('html') : $('body')) : $('html,body');
.attr({title:'Scroll Back to Top'}) mainobj.$control = $('<div id="topcontrol">' + mainobj.controlHTML + '</div>').css({
.on('click', function(){mainobj.scrollup(); return false;}) position: mainobj.cssfixedsupport ? 'fixed' : 'absolute',
.appendTo('body'); bottom: mainobj.controlattrs.offsety,
if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!==''){ //loose check for IE6 and below, plus whether control contains any text right: mainobj.controlattrs.offsetx,
mainobj.$control.css({width:mainobj.$control.width()}); //IE6- seems to require an explicit width on a DIV containing text opacity: 0,
cursor: 'pointer'
}).attr({
title: 'Scroll Back to Top'
}).on('click', function() {
mainobj.scrollup();
return false;
}).appendTo('body');
// Loose check for IE6 and below, plus whether control contains any text
if (document.all && !window.XMLHttpRequest && mainobj.$control.text() !== '') {
// IE6- seems to require an explicit width on a DIV containing text
mainobj.$control.css({
width: mainobj.$control.width()
});
} }
mainobj.togglecontrol(); mainobj.togglecontrol();
$('a[href="' + mainobj.anchorkeyword + '"]').on('click', function() { $('a[href="' + mainobj.anchorkeyword + '"]').on('click', function() {
mainobj.scrollup(); mainobj.scrollup();
return false; return false;
}); });
$(window).bind('scroll resize', function(){ $(window).on('scroll resize', function() {
mainobj.togglecontrol(); mainobj.togglecontrol();
}); });
}); });
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
"core.min.js", "core.min.js",
"vender.min.js", "vender.min.js",
"lib/**/*", "lib/**/*",
"gui/slick/js/lib/*",
"Gruntfile.js" "Gruntfile.js"
] ]
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment