<commit_before>var Upvote = (function (window, document) {

	that = this;

	// endEvent = hasTouch ? 'touchend' : 'mouseup',

	Upvote = function (opts) {

		that = this;

		this.current_category = 'us';

		// ---------------------------------------------------------
		// Muench launch
		// ---------------------------------------------------------

		// Options from user
		for (i in opts) this.options[i] = opts[i];

		// ---------------------------------------------------------
		// Skimmin launch
		// ---------------------------------------------------------

        	$('.upvote-container').on('click', this.fn_tap_upvote.bind(this));
        	$('.category-container').on('click', this.fn_change_category.bind(this));

		window.addEventListener('load', function() {
		    FastClick.attach(document.body);
		}, false);

		this.fn_hide_rendering_icons();
		this.fn_loading();
       		this.fn_reveal_content();

    	};

	Upvote.prototype = {

		// ------------------------------------------------------
		// Skimmin Core Functions
		// ------------------------------------------------------

        	// primarily used to hide slow rendering
        	fn_loading: function() {

            	that = this;

            	$('#L').fadeIn(0);
            	$('#L').addClass('animated zoomIn');

            	setTimeout(function() {
            		$('#O').fadeIn(0);
            		$('#O').addClass('animated zoomIn');
            	}, 100);

            	setTimeout(function() {
            		$('#A').fadeIn(0);
            		$('#A').addClass('animated zoomIn');
            	}, 200);

            	setTimeout(function() {
            		$('#D').fadeIn(0);
            		$('#D').addClass('animated zoomIn');
            	}, 300);

            	setTimeout(function() {
            		$('#I').fadeIn(0);
            		$('#I').addClass('animated zoomIn');
            	}, 400);

            	setTimeout(function() {
            		$('#N').fadeIn(0);
            		$('#N').addClass('animated zoomIn');
            	}, 500);

            	setTimeout(function() {
            		$('#G').fadeIn(0);
            		$('#G').addClass('animated zoomIn');
            	}, 600);

            	int_loading_count = 0;
            	arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)');

            	// bool_kill_next_loop = false;

        		// $('#loading-circle').addClass('animated pulse');

        	pulsing_circle_interval = setInterval(function() {

        			// $('#L').fadeOut(0);
        			// $('#L').addClass('zoomOut');
        			$('#L').css('opacity', '.7');

        			setTimeout(function() {
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '.7');
        			}, 100);

        			setTimeout(function() {
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '.7');
        			}, 200);

        			setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.7');
        			}, 300);

        			setTimeout(function() {
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '.7');
        			}, 400);

        			setTimeout(function() {
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '.7');
        			}, 500);

        			setTimeout(function() {
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '.7');
        			}, 600);

        			setTimeout(function() {
        				$('#G').css('opacity', '1');
        			}, 700);

        			/*setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.8');
        			}, 300);*/

        			// $('#loading-circle').css('background-color', arr_colors[int_loading_count]);
        			int_loading_count += 1;
        			if (int_loading_count == 4) {
        				clearInterval(pulsing_circle_interval);
        				setTimeout(function() {
        					$('#loading-circle').addClass('animated slideOutUp');
        					$('#loading-circle').fadeOut(300);
        				}, 500);
        				setTimeout(function() {
        					$('#content').fadeIn(300);
        					$('#content').addClass('animated slideInUp');
        				}, 750);
        			}

        			/*setTimeout(function() {
        				$('#loading-circle').css('opacity', '1');
        			}, 500);*/

        		}, 1000);

        	},

        	fn_reveal_content: function() {

        		/*setTimeout(function() {
        			$('#loading-circle').addClass('animated zoomOut');
        			$('#content').addClass('animated slideInUp');
        		}, 300);*/

        	},

        	fn_hide_rendering_icons: function() {

        		setTimeout(function() {
        			$('.rendering-container').addClass('display-none');
        		}, 3000);

        	},

        	fn_change_category: function(e) {

        		if (this.current_category == 'world') {
        			$('#category-container').removeClass('world')
        			$('#category-container').addClass('us');
        			$('#category-text').html('us');
        			this.current_category = 'us';
        		}

        		else if (this.current_category == 'us') {
        			$('#category-container').removeClass('us')
        			$('#category-container').addClass('sports');
        			$('#category-text').html('sports');
        			this.current_category = 'sports';
        		}

        		else if (this.current_category == 'sports') {
        			$('#category-container').removeClass('sports')
        			$('#category-container').addClass('business');
        			$('#category-text').html('business');
        			this.current_category = 'business';
        		}

        		else if (this.current_category == 'business') {
        			$('#category-container').removeClass('business')
        			$('#category-container').addClass('technology');
        			$('#category-text').html('technology');
        			this.current_category = 'technology';
        		}

        		else if (this.current_category == 'technology') {
        			$('#category-container').removeClass('technology')
        			$('#category-container').addClass('entertainment');
        			$('#category-text').html('entertainment');
        			this.current_category = 'entertainment';
        		}

        		else {
        			$('#category-container').removeClass('entertainment')
        			$('#category-container').addClass('world');
        			$('#category-text').html('world');
        			this.current_category = 'world';
        		}

        		if ($('.upvote-container').hasClass('upvoted') == true) {
        			$('.upvote-container').removeClass('us world sports business technology entertainment');
        			$('.upvote-text').removeClass('us world sports business technology entertainment');
        			$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			$('.upvote-container').addClass(this.current_category);
        			$('.upvote-text').addClass(this.current_category);
        			$('.upvote-icon').addClass(this.current_category);
        		}

        	},

		fn_tap_upvote: function() {

			if ($('.upvote-container').hasClass('upvoted') == true) {

				$('.upvote-container').removeClass('upvoted');

				setTimeout(function() {
        				$('.upvote-container').removeClass('tapped us world sports business technology entertainment');
        				$('.upvote-text').removeClass('us world sports business technology entertainment');
        				$('.upvote-text').html(30);
        				$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			}, 300);
        		}

			else {

				$('.upvote-container').addClass('upvoted');
    				setTimeout(function() {
        				$('.upvote-container').addClass('tapped ' + that.current_category);
        				$('.upvote-text').addClass(that.current_category);
        				$('.upvote-text').html(31);
        				$('.upvote-icon').addClass(that.current_category);
    				}, 300);
			}

		},

	};

	return Upvote;

})(window, document);
<commit_msg>Update upvote.js<commit_after>var Upvote = (function (window, document) {

	that = this;

	// endEvent = hasTouch ? 'touchend' : 'mouseup',

	Upvote = function (opts) {

		that = this;

		this.current_category = 'us';

		// ---------------------------------------------------------
		// Muench launch
		// ---------------------------------------------------------

		// Options from user
		for (i in opts) this.options[i] = opts[i];

		// ---------------------------------------------------------
		// Skimmin launch
		// ---------------------------------------------------------

        	$('.upvote-container').on('click', this.fn_tap_upvote.bind(this));
        	$('.category-container').on('click', this.fn_change_category.bind(this));

		window.addEventListener('load', function() {
		    FastClick.attach(document.body);
		}, false);

		this.fn_hide_rendering_icons();
		this.fn_loading();
       		this.fn_reveal_content();

    	};

	Upvote.prototype = {

		// ------------------------------------------------------
		// Skimmin Core Functions
		// ------------------------------------------------------

        	// primarily used to hide slow rendering
        	fn_loading: function() {

            	that = this;

            	$('#L').fadeIn(0);
            	$('#L').addClass('animated zoomIn');

            	setTimeout(function() {
            		$('#O').fadeIn(0);
            		$('#O').addClass('animated zoomIn');
            	}, 100);

            	setTimeout(function() {
            		$('#A').fadeIn(0);
            		$('#A').addClass('animated zoomIn');
            	}, 200);

            	setTimeout(function() {
            		$('#D').fadeIn(0);
            		$('#D').addClass('animated zoomIn');
            	}, 300);

            	setTimeout(function() {
            		$('#I').fadeIn(0);
            		$('#I').addClass('animated zoomIn');
            	}, 400);

            	setTimeout(function() {
            		$('#N').fadeIn(0);
            		$('#N').addClass('animated zoomIn');
            	}, 500);

            	setTimeout(function() {
            		$('#G').fadeIn(0);
            		$('#G').addClass('animated zoomIn');
            	}, 600);

            	int_loading_count = 0;
            	arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)');

            	// bool_kill_next_loop = false;

        		// $('#loading-circle').addClass('animated pulse');

        	pulsing_circle_interval = setInterval(function() {

        			// $('#L').fadeOut(0);
        			// $('#L').addClass('zoomOut');
        			$('#L').css('opacity', '.7');

        			setTimeout(function() {
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '.7');
        			}, 100);

        			setTimeout(function() {
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '.7');
        			}, 200);

        			setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.7');
        			}, 300);

        			setTimeout(function() {
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '.7');
        			}, 400);

        			setTimeout(function() {
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '.7');
        			}, 500);

        			setTimeout(function() {
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '.7');
        			}, 600);

        			setTimeout(function() {
        				$('#G').css('opacity', '1');
        			}, 700);

        			// $('#loading-circle').css('background-color', arr_colors[int_loading_count]);
        			int_loading_count += 1;
        			if (int_loading_count == 4) {
        				clearInterval(pulsing_circle_interval);
        				setTimeout(function() {
        					$('#loading-container').addClass('animated slideOutUp');
        					$('#loading-container').fadeOut(300);
        				}, 500);
        				setTimeout(function() {
        					$('#content').fadeIn(300);
        					$('#content').addClass('animated slideInUp');
        				}, 750);
        			}

        			/*setTimeout(function() {
        				$('#loading-circle').css('opacity', '1');
        			}, 500);*/

        		}, 1000);

        	},

        	fn_reveal_content: function() {

        		/*setTimeout(function() {
        			$('#loading-circle').addClass('animated zoomOut');
        			$('#content').addClass('animated slideInUp');
        		}, 300);*/

        	},

        	fn_hide_rendering_icons: function() {

        		setTimeout(function() {
        			$('.rendering-container').addClass('display-none');
        		}, 3000);

        	},

        	fn_change_category: function(e) {

        		if (this.current_category == 'world') {
        			$('#category-container').removeClass('world')
        			$('#category-container').addClass('us');
        			$('#category-text').html('us');
        			this.current_category = 'us';
        		}

        		else if (this.current_category == 'us') {
        			$('#category-container').removeClass('us')
        			$('#category-container').addClass('sports');
        			$('#category-text').html('sports');
        			this.current_category = 'sports';
        		}

        		else if (this.current_category == 'sports') {
        			$('#category-container').removeClass('sports')
        			$('#category-container').addClass('business');
        			$('#category-text').html('business');
        			this.current_category = 'business';
        		}

        		else if (this.current_category == 'business') {
        			$('#category-container').removeClass('business')
        			$('#category-container').addClass('technology');
        			$('#category-text').html('technology');
        			this.current_category = 'technology';
        		}

        		else if (this.current_category == 'technology') {
        			$('#category-container').removeClass('technology')
        			$('#category-container').addClass('entertainment');
        			$('#category-text').html('entertainment');
        			this.current_category = 'entertainment';
        		}

        		else {
        			$('#category-container').removeClass('entertainment')
        			$('#category-container').addClass('world');
        			$('#category-text').html('world');
        			this.current_category = 'world';
        		}

        		if ($('.upvote-container').hasClass('upvoted') == true) {
        			$('.upvote-container').removeClass('us world sports business technology entertainment');
        			$('.upvote-text').removeClass('us world sports business technology entertainment');
        			$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			$('.upvote-container').addClass(this.current_category);
        			$('.upvote-text').addClass(this.current_category);
        			$('.upvote-icon').addClass(this.current_category);
        		}

        	},

		fn_tap_upvote: function() {

			if ($('.upvote-container').hasClass('upvoted') == true) {

				$('.upvote-container').removeClass('upvoted');

				setTimeout(function() {
        				$('.upvote-container').removeClass('tapped us world sports business technology entertainment');
        				$('.upvote-text').removeClass('us world sports business technology entertainment');
        				$('.upvote-text').html(30);
        				$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			}, 300);
        		}

			else {

				$('.upvote-container').addClass('upvoted');
    				setTimeout(function() {
        				$('.upvote-container').addClass('tapped ' + that.current_category);
        				$('.upvote-text').addClass(that.current_category);
        				$('.upvote-text').html(31);
        				$('.upvote-icon').addClass(that.current_category);
    				}, 300);
			}

		},

	};

	return Upvote;

})(window, document);
<|endoftext|>


<commit_before>var Upvote = (function (window, document) {

	that = this;

	// endEvent = hasTouch ? 'touchend' : 'mouseup',

	Upvote = function (opts) {

		that = this;

		this.current_category = 'us';

		// ---------------------------------------------------------
		// Muench launch
		// ---------------------------------------------------------

		// Options from user
		for (i in opts) this.options[i] = opts[i];

		// ---------------------------------------------------------
		// Skimmin launch
		// ---------------------------------------------------------

        	$('.upvote-container').on('click', this.fn_tap_upvote.bind(this));
        	$('.category-container').on('click', this.fn_change_category.bind(this));

		window.addEventListener('load', function() {
		    FastClick.attach(document.body);
		}, false);

		this.fn_hide_rendering_icons();
		this.fn_loading();
       		this.fn_reveal_content();

    	};

	Upvote.prototype = {

		// ------------------------------------------------------
		// Skimmin Core Functions
		// ------------------------------------------------------

        	// primarily used to hide slow rendering
        	fn_loading: function() {

            	that = this;

            	$('#L').fadeIn(0);
            	$('#L').addClass('animated zoomIn');

            	setTimeout(function() {
            		$('#O').fadeIn(0);
            		$('#O').addClass('animated zoomIn');
            	}, 75);

            	setTimeout(function() {
            		$('#A').fadeIn(0);
            		$('#A').addClass('animated zoomIn');
            	}, 150);

            	setTimeout(function() {
            		$('#D').fadeIn(0);
            		$('#D').addClass('animated zoomIn');
            	}, 225);

            	setTimeout(function() {
            		$('#I').fadeIn(0);
            		$('#I').addClass('animated zoomIn');
            	}, 300);

            	setTimeout(function() {
            		$('#N').fadeIn(0);
            		$('#N').addClass('animated zoomIn');
            	}, 375);

            	setTimeout(function() {
            		$('#G').fadeIn(0);
            		$('#G').addClass('animated zoomIn');
            	}, 450);

            	setTimeout(function() {
            		$('#loading-container').addClass('animated pulse');
            	}, 1500);

            	/*setTimeout(function() {
            		$('#L').removeClass('animated zoomIn');
            		$('#O').removeClass('animated zoomIn');
            		$('#A').removeClass('animated zoomIn');
            		$('#D').removeClass('animated zoomIn');
            		$('#I').removeClass('animated zoomIn');
            		$('#N').removeClass('animated zoomIn');
            		$('#G').removeClass('animated zoomIn');
            	}, 1500);*/

            	int_loading_count = 0;
            	arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)');

            	// bool_kill_next_loop = false;

        		// $('#loading-circle').addClass('animated pulse');

        	pulsing_circle_interval = setInterval(function() {

        			/*if (int_loading_count == 0 || int_loading_count == 2 || int_loading_count == 4 || int_loading_count == 6 || int_loading_count == 8) {
        				$('#L').css('opacity', '0');
        				$('#O').css('opacity', '0');
        				$('#A').css('opacity', '0');
        				$('#D').css('opacity', '0');
        				$('#I').css('opacity', '0');
        				$('#N').css('opacity', '0');
        				$('#G').css('opacity', '0');
        			}
        			else {
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '1');
        			}*/

        			// $('#L').addClass('zoomOut');
        			/*$('#L').css('opacity', '.7');

        			setTimeout(function() {
        				// $('#O').addClass('zoomOut');
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '.7');
        			}, 75);

        			setTimeout(function() {
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '.7');
        			}, 150);

        			setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.7');
        			}, 225);

        			setTimeout(function() {
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '.7');
        			}, 300);

        			setTimeout(function() {
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '.7');
        			}, 375);

        			setTimeout(function() {
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '.7');
        			}, 450);*/

        			// $('#loading-circle').css('background-color', arr_colors[int_loading_count]);
        			int_loading_count += 1;
        			if (int_loading_count == 8) {
        				clearInterval(pulsing_circle_interval);
        				setTimeout(function() {
        					$('#loading-container').addClass('animated slideOutUp');
        					$('#loading-container').fadeOut(300);
        				}, 500);
        				setTimeout(function() {
        					$('#content').fadeIn(300);
        					$('#content').addClass('animated slideInUp');
        				}, 750);
        			}

        			/*setTimeout(function() {
        				$('#loading-circle').css('opacity', '1');
        			}, 500);*/

        		}, 1500);

        	},

        	fn_reveal_content: function() {

        		/*setTimeout(function() {
        			$('#loading-circle').addClass('animated zoomOut');
        			$('#content').addClass('animated slideInUp');
        		}, 300);*/

        	},

        	fn_hide_rendering_icons: function() {

        		setTimeout(function() {
        			$('.rendering-container').addClass('display-none');
        		}, 3000);

        	},

        	fn_change_category: function(e) {

        		if (this.current_category == 'world') {
        			$('#category-container').removeClass('world')
        			$('#category-container').addClass('us');
        			$('#category-text').html('us');
        			this.current_category = 'us';
        		}

        		else if (this.current_category == 'us') {
        			$('#category-container').removeClass('us')
        			$('#category-container').addClass('sports');
        			$('#category-text').html('sports');
        			this.current_category = 'sports';
        		}

        		else if (this.current_category == 'sports') {
        			$('#category-container').removeClass('sports')
        			$('#category-container').addClass('business');
        			$('#category-text').html('business');
        			this.current_category = 'business';
        		}

        		else if (this.current_category == 'business') {
        			$('#category-container').removeClass('business')
        			$('#category-container').addClass('technology');
        			$('#category-text').html('technology');
        			this.current_category = 'technology';
        		}

        		else if (this.current_category == 'technology') {
        			$('#category-container').removeClass('technology')
        			$('#category-container').addClass('entertainment');
        			$('#category-text').html('entertainment');
        			this.current_category = 'entertainment';
        		}

        		else {
        			$('#category-container').removeClass('entertainment')
        			$('#category-container').addClass('world');
        			$('#category-text').html('world');
        			this.current_category = 'world';
        		}

        		if ($('.upvote-container').hasClass('upvoted') == true) {
        			$('.upvote-container').removeClass('us world sports business technology entertainment');
        			$('.upvote-text').removeClass('us world sports business technology entertainment');
        			$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			$('.upvote-container').addClass(this.current_category);
        			$('.upvote-text').addClass(this.current_category);
        			$('.upvote-icon').addClass(this.current_category);
        		}

        	},

		fn_tap_upvote: function() {

			if ($('.upvote-container').hasClass('upvoted') == true) {

				$('.upvote-container').removeClass('upvoted');

				setTimeout(function() {
        				$('.upvote-container').removeClass('tapped us world sports business technology entertainment');
        				$('.upvote-text').removeClass('us world sports business technology entertainment');
        				$('.upvote-text').html(30);
        				$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			}, 300);
        		}

			else {

				$('.upvote-container').addClass('upvoted');
    				setTimeout(function() {
        				$('.upvote-container').addClass('tapped ' + that.current_category);
        				$('.upvote-text').addClass(that.current_category);
        				$('.upvote-text').html(31);
        				$('.upvote-icon').addClass(that.current_category);
    				}, 300);
			}

		},

	};

	return Upvote;

})(window, document);
<commit_msg>Update upvote.js<commit_after>var Upvote = (function (window, document) {

	that = this;

	// endEvent = hasTouch ? 'touchend' : 'mouseup',

	Upvote = function (opts) {

		that = this;

		this.current_category = 'us';

		// ---------------------------------------------------------
		// Muench launch
		// ---------------------------------------------------------

		// Options from user
		for (i in opts) this.options[i] = opts[i];

		// ---------------------------------------------------------
		// Skimmin launch
		// ---------------------------------------------------------

        	$('.upvote-container').on('click', this.fn_tap_upvote.bind(this));
        	$('.category-container').on('click', this.fn_change_category.bind(this));

		window.addEventListener('load', function() {
		    FastClick.attach(document.body);
		}, false);

		this.fn_hide_rendering_icons();
		this.fn_loading();
       		this.fn_reveal_content();

    	};

	Upvote.prototype = {

		// ------------------------------------------------------
		// Skimmin Core Functions
		// ------------------------------------------------------

        	// primarily used to hide slow rendering
        	fn_loading: function() {

            	that = this;

            	$('#L').fadeIn(0);
            	$('#L').addClass('animated zoomIn');

            	setTimeout(function() {
            		$('#O').fadeIn(0);
            		$('#O').addClass('animated zoomIn');
            	}, 75);

            	setTimeout(function() {
            		$('#A').fadeIn(0);
            		$('#A').addClass('animated zoomIn');
            	}, 150);

            	setTimeout(function() {
            		$('#D').fadeIn(0);
            		$('#D').addClass('animated zoomIn');
            	}, 225);

            	setTimeout(function() {
            		$('#I').fadeIn(0);
            		$('#I').addClass('animated zoomIn');
            	}, 300);

            	setTimeout(function() {
            		$('#N').fadeIn(0);
            		$('#N').addClass('animated zoomIn');
            	}, 375);

            	setTimeout(function() {
            		$('#G').fadeIn(0);
            		$('#G').addClass('animated zoomIn');
            	}, 450);

            	setTimeout(function() {
            		$('#loading-container').addClass('animated pulse');
            	}, 1500);

            	/*setTimeout(function() {
            		$('#L').removeClass('animated zoomIn');
            		$('#O').removeClass('animated zoomIn');
            		$('#A').removeClass('animated zoomIn');
            		$('#D').removeClass('animated zoomIn');
            		$('#I').removeClass('animated zoomIn');
            		$('#N').removeClass('animated zoomIn');
            		$('#G').removeClass('animated zoomIn');
            	}, 1500);*/

            	int_loading_count = 0;
            	arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)');

            	// bool_kill_next_loop = false;

        		// $('#loading-circle').addClass('animated pulse');

        	pulsing_circle_interval = setInterval(function() {

        			$('#L').fadeOut(300);
        			$('#O').fadeOut(300);
        			$('#A').fadeOut(300);
        			$('#D').fadeOut(300);
        			$('#I').fadeOut(300);
        			$('#N').fadeOut(300);
        			$('#G').fadeOut(300);

        			setTimeout(function() {
        				$('#L').removeClass('animated zoomIn');
        				$('#O').removeClass('animated zoomIn');
        				$('#A').removeClass('animated zoomIn');
        				$('#D').removeClass('animated zoomIn');
        				$('#I').removeClass('animated zoomIn');
        				$('#N').removeClass('animated zoomIn');
        				$('#G').removeClass('animated zoomIn');
        			}, 300);

        			setTimeout(function(){
        				$('#L').addClass('animated zoomIn');
        				$('#O').addClass('animated zoomIn');
        				$('#A').addClass('animated zoomIn');
        				$('#D').addClass('animated zoomIn');
        				$('#I').addClass('animated zoomIn');
        				$('#N').addClass('animated zoomIn');
        				$('#G').addClass('animated zoomIn');
        			})

        			/*if (int_loading_count == 0 || int_loading_count == 2 || int_loading_count == 4 || int_loading_count == 6 || int_loading_count == 8) {
        				$('#L').css('opacity', '0');
        				$('#O').css('opacity', '0');
        				$('#A').css('opacity', '0');
        				$('#D').css('opacity', '0');
        				$('#I').css('opacity', '0');
        				$('#N').css('opacity', '0');
        				$('#G').css('opacity', '0');
        			}
        			else {
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '1');
        			}*/

        			// $('#L').addClass('zoomOut');
        			/*$('#L').css('opacity', '.7');

        			setTimeout(function() {
        				// $('#O').addClass('zoomOut');
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '.7');
        			}, 75);

        			setTimeout(function() {
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '.7');
        			}, 150);

        			setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.7');
        			}, 225);

        			setTimeout(function() {
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '.7');
        			}, 300);

        			setTimeout(function() {
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '.7');
        			}, 375);

        			setTimeout(function() {
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '.7');
        			}, 450);*/

        			// $('#loading-circle').css('background-color', arr_colors[int_loading_count]);
        			int_loading_count += 1;
        			if (int_loading_count == 8) {
        				clearInterval(pulsing_circle_interval);
        				setTimeout(function() {
        					$('#loading-container').addClass('animated slideOutUp');
        					$('#loading-container').fadeOut(300);
        				}, 500);
        				setTimeout(function() {
        					$('#content').fadeIn(300);
        					$('#content').addClass('animated slideInUp');
        				}, 750);
        			}

        			/*setTimeout(function() {
        				$('#loading-circle').css('opacity', '1');
        			}, 500);*/

        		}, 1500);

        	},

        	fn_reveal_content: function() {

        		/*setTimeout(function() {
        			$('#loading-circle').addClass('animated zoomOut');
        			$('#content').addClass('animated slideInUp');
        		}, 300);*/

        	},

        	fn_hide_rendering_icons: function() {

        		setTimeout(function() {
        			$('.rendering-container').addClass('display-none');
        		}, 3000);

        	},

        	fn_change_category: function(e) {

        		if (this.current_category == 'world') {
        			$('#category-container').removeClass('world')
        			$('#category-container').addClass('us');
        			$('#category-text').html('us');
        			this.current_category = 'us';
        		}

        		else if (this.current_category == 'us') {
        			$('#category-container').removeClass('us')
        			$('#category-container').addClass('sports');
        			$('#category-text').html('sports');
        			this.current_category = 'sports';
        		}

        		else if (this.current_category == 'sports') {
        			$('#category-container').removeClass('sports')
        			$('#category-container').addClass('business');
        			$('#category-text').html('business');
        			this.current_category = 'business';
        		}

        		else if (this.current_category == 'business') {
        			$('#category-container').removeClass('business')
        			$('#category-container').addClass('technology');
        			$('#category-text').html('technology');
        			this.current_category = 'technology';
        		}

        		else if (this.current_category == 'technology') {
        			$('#category-container').removeClass('technology')
        			$('#category-container').addClass('entertainment');
        			$('#category-text').html('entertainment');
        			this.current_category = 'entertainment';
        		}

        		else {
        			$('#category-container').removeClass('entertainment')
        			$('#category-container').addClass('world');
        			$('#category-text').html('world');
        			this.current_category = 'world';
        		}

        		if ($('.upvote-container').hasClass('upvoted') == true) {
        			$('.upvote-container').removeClass('us world sports business technology entertainment');
        			$('.upvote-text').removeClass('us world sports business technology entertainment');
        			$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			$('.upvote-container').addClass(this.current_category);
        			$('.upvote-text').addClass(this.current_category);
        			$('.upvote-icon').addClass(this.current_category);
        		}

        	},

		fn_tap_upvote: function() {

			if ($('.upvote-container').hasClass('upvoted') == true) {

				$('.upvote-container').removeClass('upvoted');

				setTimeout(function() {
        				$('.upvote-container').removeClass('tapped us world sports business technology entertainment');
        				$('.upvote-text').removeClass('us world sports business technology entertainment');
        				$('.upvote-text').html(30);
        				$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			}, 300);
        		}

			else {

				$('.upvote-container').addClass('upvoted');
    				setTimeout(function() {
        				$('.upvote-container').addClass('tapped ' + that.current_category);
        				$('.upvote-text').addClass(that.current_category);
        				$('.upvote-text').html(31);
        				$('.upvote-icon').addClass(that.current_category);
    				}, 300);
			}

		},

	};

	return Upvote;

})(window, document);
<|endoftext|>


<commit_before>var Upvote = (function (window, document) {

	that = this;

	// endEvent = hasTouch ? 'touchend' : 'mouseup',

	Upvote = function (opts) {

		that = this;

		this.current_category = 'us';

		// ---------------------------------------------------------
		// Muench launch
		// ---------------------------------------------------------

		// Options from user
		for (i in opts) this.options[i] = opts[i];

		// ---------------------------------------------------------
		// Skimmin launch
		// ---------------------------------------------------------

        	$('.upvote-container').on('click', this.fn_tap_upvote.bind(this));
        	$('.category-container').on('click', this.fn_change_category.bind(this));

		window.addEventListener('load', function() {
		    FastClick.attach(document.body);
		}, false);

		this.fn_hide_rendering_icons();
		this.fn_loading();
       		this.fn_reveal_content();

    	};

	Upvote.prototype = {

		// ------------------------------------------------------
		// Skimmin Core Functions
		// ------------------------------------------------------

        	// primarily used to hide slow rendering
        	fn_loading: function() {

            	that = this;

            	$('#L').fadeIn(0);
            	$('#L').addClass('animated zoomIn');

            	setTimeout(function() {
            		$('#O').fadeIn(0);
            		$('#O').addClass('animated zoomIn');
            	}, 75);

            	setTimeout(function() {
            		$('#A').fadeIn(0);
            		$('#A').addClass('animated zoomIn');
            	}, 150);

            	setTimeout(function() {
            		$('#D').fadeIn(0);
            		$('#D').addClass('animated zoomIn');
            	}, 225);

            	setTimeout(function() {
            		$('#I').fadeIn(0);
            		$('#I').addClass('animated zoomIn');
            	}, 300);

            	setTimeout(function() {
            		$('#N').fadeIn(0);
            		$('#N').addClass('animated zoomIn');
            	}, 375);

            	setTimeout(function() {
            		$('#G').fadeIn(0);
            		$('#G').addClass('animated zoomIn');
            	}, 450);

            	/*setTimeout(function() {
            		$('#loading-container').addClass('animated pulse');
            	}, 1500);*/

            	/*setTimeout(function() {
            		$('#L').removeClass('animated zoomIn');
            		$('#O').removeClass('animated zoomIn');
            		$('#A').removeClass('animated zoomIn');
            		$('#D').removeClass('animated zoomIn');
            		$('#I').removeClass('animated zoomIn');
            		$('#N').removeClass('animated zoomIn');
            		$('#G').removeClass('animated zoomIn');
            	}, 1500);*/

            	int_loading_count = 0;
            	arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)');

            	// bool_kill_next_loop = false;

        		// $('#loading-circle').addClass('animated pulse');

        	pulsing_circle_interval = setInterval(function() {

        			/*$('#L').fadeOut(300);
        			$('#O').fadeOut(300);
        			$('#A').fadeOut(300);
        			$('#D').fadeOut(300);
        			$('#I').fadeOut(300);
        			$('#N').fadeOut(300);
        			$('#G').fadeOut(300);*/

        			if (int_loading_count == 0 || int_loading_count == 1 || int_loading_count == 2 || int_loading_count == 3) {

        				/*$('#L').fadeIn(150);

            				setTimeout(function() {
            					$('#O').fadeIn(150);
            				}, 75);

            				setTimeout(function() {
            					$('#A').fadeIn(150);
            				}, 150);

            				setTimeout(function() {
            					$('#D').fadeIn(150);
            				}, 225);

            				setTimeout(function() {
            					$('#I').fadeIn(150);
            				}, 300);

            				setTimeout(function() {
            					$('#N').fadeIn(150);
            				}, 375);

            				setTimeout(function() {
            					$('#G').fadeIn(150);
            				}, 450); */

        				/*$('#L').css('opacity', '.5');
        				$('#O').css('opacity', '.5');
        				$('#A').css('opacity', '.5');
        				$('#D').css('opacity', '.5');
        				$('#I').css('opacity', '.5');
        				$('#N').css('opacity', '.5');
        				$('#G').css('opacity', '.5');

        				setTimeout(function() {
        					$('#L').css('opacity', '1');
        					$('#O').css('opacity', '1');
        					$('#A').css('opacity', '1');
        					$('#D').css('opacity', '1');
        					$('#I').css('opacity', '1');
        					$('#N').css('opacity', '1');
        					$('#G').css('opacity', '1');
        				}, 1000);*/

        				$('#loading-container').css('opacity', '.4');

        				setTimeout(function(){
        					$('#loading-container').css('opacity', '1');
        				}, 1000);

        				/*$('#L').css('-webkit-transform', 'translateY(-5px)');
        				setTimeout(function() {
        					$('#L').css('-webkit-transform', 'translateY(0px)');
        				}, 300);

        				setTimeout(function() {
        					$('#O').css('-webkit-transform', 'translateY(-5px)');
        				}, 100);
        				setTimeout(function() {
        					$('#O').css('-webkit-transform', 'translateY(0px)');
        				}, 400);

        				setTimeout(function() {
        					$('#A').css('-webkit-transform', 'translateY(-5px)');
        				}, 200);
        				setTimeout(function() {
        					$('#A').css('-webkit-transform', 'translateY(0px)');
        				}, 500);

        				setTimeout(function() {
        					$('#D').css('-webkit-transform', 'translateY(-5px)');
        				}, 300);
        				setTimeout(function() {
        					$('#D').css('-webkit-transform', 'translateY(0px)');
        				}, 600);

        				setTimeout(function() {
        					$('#I').css('-webkit-transform', 'translateY(-5px)');
        				}, 400);
        				setTimeout(function() {
        					$('#I').css('-webkit-transform', 'translateY(0px)');
        				}, 700);

        				setTimeout(function() {
        					$('#N').css('-webkit-transform', 'translateY(-5px)');
        				}, 500);
        				setTimeout(function() {
        					$('#N').css('-webkit-transform', 'translateY(0px)');
        				}, 800);

        				setTimeout(function() {
        					$('#G').css('-webkit-transform', 'translateY(-5px)');
        				}, 600);
        				setTimeout(function() {
        					$('#G').css('-webkit-transform', 'translateY(0px)');
        				}, 900);*/

        				/*setTimeout(function() {
        					$('#L').fadeOut(150);
        				}, 1000);
        				setTimeout(function() {
        					$('#O').fadeOut(150);
        				}, 1075);
        				setTimeout(function() {
        					$('#A').fadeOut(150);
        				}, 1150);
        				setTimeout(function() {
        					$('#D').fadeOut(150);
        				}, 1225);
        				setTimeout(function() {
        					$('#I').fadeOut(150);
        				}, 1300);
        				setTimeout(function() {
        					$('#N').fadeOut(150);
        				}, 1375);
        				setTimeout(function() {
        					$('#G').fadeOut(150);
        				}, 1450);*/
        			}

        			/*if (int_loading_count == 0 || int_loading_count == 2 || int_loading_count == 4 || int_loading_count == 6 || int_loading_count == 8) {
        				$('#L').css('opacity', '0');
        				$('#O').css('opacity', '0');
        				$('#A').css('opacity', '0');
        				$('#D').css('opacity', '0');
        				$('#I').css('opacity', '0');
        				$('#N').css('opacity', '0');
        				$('#G').css('opacity', '0');
        			}
        			else {
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '1');
        			}*/

        			// $('#L').addClass('zoomOut');
        			/*$('#L').css('opacity', '.7');

        			setTimeout(function() {
        				// $('#O').addClass('zoomOut');
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '.7');
        			}, 75);

        			setTimeout(function() {
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '.7');
        			}, 150);

        			setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.7');
        			}, 225);

        			setTimeout(function() {
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '.7');
        			}, 300);

        			setTimeout(function() {
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '.7');
        			}, 375);

        			setTimeout(function() {
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '.7');
        			}, 450);*/

        			// $('#loading-circle').css('background-color', arr_colors[int_loading_count]);
        			int_loading_count += 1;
        			if (int_loading_count == 4) {
        				clearInterval(pulsing_circle_interval);
        				setTimeout(function() {
        					// $('#loading-container').addClass('animated slideOutUp');
        					$('#loading-container').fadeOut(300);
        				}, 500);
        				setTimeout(function() {
        					$('#content').fadeIn(0);
        					$('#content').addClass('animated bounceInUp');
        					// $('#content').addClass('animated slideInUp');
        				}, 750);
        			}

        			/*setTimeout(function() {
        				$('#loading-circle').css('opacity', '1');
        			}, 500);*/

        		}, 2000);

        	},

        	fn_reveal_content: function() {

        		/*setTimeout(function() {
        			$('#loading-circle').addClass('animated zoomOut');
        			$('#content').addClass('animated slideInUp');
        		}, 300);*/

        	},

        	fn_hide_rendering_icons: function() {

        		setTimeout(function() {
        			$('.rendering-container').addClass('display-none');
        		}, 3000);

        	},

        	fn_change_category: function(e) {

        		if (this.current_category == 'world') {
        			$('#category-container').removeClass('world')
        			$('#category-container').addClass('us');
        			$('#category-text').html('us');
        			this.current_category = 'us';
        		}

        		else if (this.current_category == 'us') {
        			$('#category-container').removeClass('us')
        			$('#category-container').addClass('sports');
        			$('#category-text').html('sports');
        			this.current_category = 'sports';
        		}

        		else if (this.current_category == 'sports') {
        			$('#category-container').removeClass('sports')
        			$('#category-container').addClass('business');
        			$('#category-text').html('business');
        			this.current_category = 'business';
        		}

        		else if (this.current_category == 'business') {
        			$('#category-container').removeClass('business')
        			$('#category-container').addClass('technology');
        			$('#category-text').html('technology');
        			this.current_category = 'technology';
        		}

        		else if (this.current_category == 'technology') {
        			$('#category-container').removeClass('technology')
        			$('#category-container').addClass('entertainment');
        			$('#category-text').html('entertainment');
        			this.current_category = 'entertainment';
        		}

        		else {
        			$('#category-container').removeClass('entertainment')
        			$('#category-container').addClass('world');
        			$('#category-text').html('world');
        			this.current_category = 'world';
        		}

        		if ($('.upvote-container').hasClass('upvoted') == true) {
        			$('.upvote-container').removeClass('us world sports business technology entertainment');
        			$('.upvote-text').removeClass('us world sports business technology entertainment');
        			$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			$('.upvote-container').addClass(this.current_category);
        			$('.upvote-text').addClass(this.current_category);
        			$('.upvote-icon').addClass(this.current_category);
        		}
        		else {
        			$('.upvote-container').css('background-color', '#f8f8f8');
        			setTimeout(function() {
        				$('.upvote-container').css('background-color', '#f2f2f2');
        			}, 150);
        		}

        	},

		fn_tap_upvote: function() {

			if ($('.upvote-container').hasClass('upvoted') == true) {

				$('.upvote-container').removeClass('upvoted');

				setTimeout(function() {
        				$('.upvote-container').removeClass('tapped us world sports business technology entertainment');
        				$('.upvote-text').removeClass('us world sports business technology entertainment');
        				$('.upvote-text').html(30);
        				$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			}, 300);
        		}

			else {

				$('.upvote-container').addClass('upvoted');
    				setTimeout(function() {
        				$('.upvote-container').addClass('tapped ' + that.current_category);
        				$('.upvote-text').addClass(that.current_category);
        				$('.upvote-text').html(31);
        				$('.upvote-icon').addClass(that.current_category);
    				}, 300);
			}

		},

	};

	return Upvote;

})(window, document);
<commit_msg>Update upvote.js<commit_after>var Upvote = (function (window, document) {

	that = this;

	// endEvent = hasTouch ? 'touchend' : 'mouseup',

	Upvote = function (opts) {

		that = this;

		this.current_category = 'us';

		// ---------------------------------------------------------
		// Muench launch
		// ---------------------------------------------------------

		// Options from user
		for (i in opts) this.options[i] = opts[i];

		// ---------------------------------------------------------
		// Skimmin launch
		// ---------------------------------------------------------

        	$('.upvote-container').on('click', this.fn_tap_upvote.bind(this));
        	$('.category-container').on('click', this.fn_change_category.bind(this));

		window.addEventListener('load', function() {
		    FastClick.attach(document.body);
		}, false);

		this.fn_hide_rendering_icons();
		this.fn_loading();
       		this.fn_reveal_content();

    	};

	Upvote.prototype = {

		// ------------------------------------------------------
		// Skimmin Core Functions
		// ------------------------------------------------------

        	// primarily used to hide slow rendering
        	fn_loading: function() {

            	that = this;

            	$('#L').fadeIn(0);
            	$('#L').addClass('animated zoomIn');

            	setTimeout(function() {
            		$('#O').fadeIn(0);
            		$('#O').addClass('animated zoomIn');
            	}, 75);

            	setTimeout(function() {
            		$('#A').fadeIn(0);
            		$('#A').addClass('animated zoomIn');
            	}, 150);

            	setTimeout(function() {
            		$('#D').fadeIn(0);
            		$('#D').addClass('animated zoomIn');
            	}, 225);

            	setTimeout(function() {
            		$('#I').fadeIn(0);
            		$('#I').addClass('animated zoomIn');
            	}, 300);

            	setTimeout(function() {
            		$('#N').fadeIn(0);
            		$('#N').addClass('animated zoomIn');
            	}, 375);

            	setTimeout(function() {
            		$('#G').fadeIn(0);
            		$('#G').addClass('animated zoomIn');
            	}, 450);

            	/*setTimeout(function() {
            		$('#loading-container').addClass('animated pulse');
            	}, 1500);*/

            	/*setTimeout(function() {
            		$('#L').removeClass('animated zoomIn');
            		$('#O').removeClass('animated zoomIn');
            		$('#A').removeClass('animated zoomIn');
            		$('#D').removeClass('animated zoomIn');
            		$('#I').removeClass('animated zoomIn');
            		$('#N').removeClass('animated zoomIn');
            		$('#G').removeClass('animated zoomIn');
            	}, 1500);*/

            	int_loading_count = 0;
            	arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)');

            	// bool_kill_next_loop = false;

        		// $('#loading-circle').addClass('animated pulse');

        	pulsing_circle_interval = setInterval(function() {

        			/*$('#L').fadeOut(300);
        			$('#O').fadeOut(300);
        			$('#A').fadeOut(300);
        			$('#D').fadeOut(300);
        			$('#I').fadeOut(300);
        			$('#N').fadeOut(300);
        			$('#G').fadeOut(300);*/

        			if (int_loading_count == 0 || int_loading_count == 1 || int_loading_count == 2 || int_loading_count == 3) {

        				/*$('#L').fadeIn(150);

            				setTimeout(function() {
            					$('#O').fadeIn(150);
            				}, 75);

            				setTimeout(function() {
            					$('#A').fadeIn(150);
            				}, 150);

            				setTimeout(function() {
            					$('#D').fadeIn(150);
            				}, 225);

            				setTimeout(function() {
            					$('#I').fadeIn(150);
            				}, 300);

            				setTimeout(function() {
            					$('#N').fadeIn(150);
            				}, 375);

            				setTimeout(function() {
            					$('#G').fadeIn(150);
            				}, 450); */

        				/*$('#L').css('opacity', '.5');
        				$('#O').css('opacity', '.5');
        				$('#A').css('opacity', '.5');
        				$('#D').css('opacity', '.5');
        				$('#I').css('opacity', '.5');
        				$('#N').css('opacity', '.5');
        				$('#G').css('opacity', '.5');

        				setTimeout(function() {
        					$('#L').css('opacity', '1');
        					$('#O').css('opacity', '1');
        					$('#A').css('opacity', '1');
        					$('#D').css('opacity', '1');
        					$('#I').css('opacity', '1');
        					$('#N').css('opacity', '1');
        					$('#G').css('opacity', '1');
        				}, 1000);*/

        				$('#loading-container').css('opacity', '.4');

        				setTimeout(function(){
        					$('#loading-container').css('opacity', '1');
        				}, 1000);

        				/*$('#L').css('-webkit-transform', 'translateY(-5px)');
        				setTimeout(function() {
        					$('#L').css('-webkit-transform', 'translateY(0px)');
        				}, 300);

        				setTimeout(function() {
        					$('#O').css('-webkit-transform', 'translateY(-5px)');
        				}, 100);
        				setTimeout(function() {
        					$('#O').css('-webkit-transform', 'translateY(0px)');
        				}, 400);

        				setTimeout(function() {
        					$('#A').css('-webkit-transform', 'translateY(-5px)');
        				}, 200);
        				setTimeout(function() {
        					$('#A').css('-webkit-transform', 'translateY(0px)');
        				}, 500);

        				setTimeout(function() {
        					$('#D').css('-webkit-transform', 'translateY(-5px)');
        				}, 300);
        				setTimeout(function() {
        					$('#D').css('-webkit-transform', 'translateY(0px)');
        				}, 600);

        				setTimeout(function() {
        					$('#I').css('-webkit-transform', 'translateY(-5px)');
        				}, 400);
        				setTimeout(function() {
        					$('#I').css('-webkit-transform', 'translateY(0px)');
        				}, 700);

        				setTimeout(function() {
        					$('#N').css('-webkit-transform', 'translateY(-5px)');
        				}, 500);
        				setTimeout(function() {
        					$('#N').css('-webkit-transform', 'translateY(0px)');
        				}, 800);

        				setTimeout(function() {
        					$('#G').css('-webkit-transform', 'translateY(-5px)');
        				}, 600);
        				setTimeout(function() {
        					$('#G').css('-webkit-transform', 'translateY(0px)');
        				}, 900);*/

        				/*setTimeout(function() {
        					$('#L').fadeOut(150);
        				}, 1000);
        				setTimeout(function() {
        					$('#O').fadeOut(150);
        				}, 1075);
        				setTimeout(function() {
        					$('#A').fadeOut(150);
        				}, 1150);
        				setTimeout(function() {
        					$('#D').fadeOut(150);
        				}, 1225);
        				setTimeout(function() {
        					$('#I').fadeOut(150);
        				}, 1300);
        				setTimeout(function() {
        					$('#N').fadeOut(150);
        				}, 1375);
        				setTimeout(function() {
        					$('#G').fadeOut(150);
        				}, 1450);*/
        			}

        			/*if (int_loading_count == 0 || int_loading_count == 2 || int_loading_count == 4 || int_loading_count == 6 || int_loading_count == 8) {
        				$('#L').css('opacity', '0');
        				$('#O').css('opacity', '0');
        				$('#A').css('opacity', '0');
        				$('#D').css('opacity', '0');
        				$('#I').css('opacity', '0');
        				$('#N').css('opacity', '0');
        				$('#G').css('opacity', '0');
        			}
        			else {
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '1');
        			}*/

        			// $('#L').addClass('zoomOut');
        			/*$('#L').css('opacity', '.7');

        			setTimeout(function() {
        				// $('#O').addClass('zoomOut');
        				$('#L').css('opacity', '1');
        				$('#O').css('opacity', '.7');
        			}, 75);

        			setTimeout(function() {
        				$('#O').css('opacity', '1');
        				$('#A').css('opacity', '.7');
        			}, 150);

        			setTimeout(function() {
        				$('#A').css('opacity', '1');
        				$('#D').css('opacity', '.7');
        			}, 225);

        			setTimeout(function() {
        				$('#D').css('opacity', '1');
        				$('#I').css('opacity', '.7');
        			}, 300);

        			setTimeout(function() {
        				$('#I').css('opacity', '1');
        				$('#N').css('opacity', '.7');
        			}, 375);

        			setTimeout(function() {
        				$('#N').css('opacity', '1');
        				$('#G').css('opacity', '.7');
        			}, 450);*/

        			// $('#loading-circle').css('background-color', arr_colors[int_loading_count]);
        			int_loading_count += 1;
        			if (int_loading_count == 4) {
        				clearInterval(pulsing_circle_interval);
        				setTimeout(function() {
        					// $('#loading-container').addClass('animated slideOutUp');
        					$('#loading-container').fadeOut(300);
        				}, 500);
        				setTimeout(function() {
        					$('#content').fadeIn(0);
        					$('#content').addClass('animated bounceInUp');
        					// $('#content').addClass('animated slideInUp');
        				}, 750);
        			}

        			/*setTimeout(function() {
        				$('#loading-circle').css('opacity', '1');
        			}, 500);*/

        		}, 2000);

        	},

        	fn_reveal_content: function() {

        		/*setTimeout(function() {
        			$('#loading-circle').addClass('animated zoomOut');
        			$('#content').addClass('animated slideInUp');
        		}, 300);*/

        	},

        	fn_hide_rendering_icons: function() {

        		setTimeout(function() {
        			$('.rendering-container').addClass('display-none');
        		}, 3000);

        	},

        	fn_change_category: function(e) {

        		if (this.current_category == 'world') {
        			$('#category-container').removeClass('world')
        			$('#category-container').addClass('us');
        			$('#category-text').html('us');
        			this.current_category = 'us';
        		}

        		else if (this.current_category == 'us') {
        			$('#category-container').removeClass('us')
        			$('#category-container').addClass('sports');
        			$('#category-text').html('sports');
        			this.current_category = 'sports';
        		}

        		else if (this.current_category == 'sports') {
        			$('#category-container').removeClass('sports')
        			$('#category-container').addClass('business');
        			$('#category-text').html('business');
        			this.current_category = 'business';
        		}

        		else if (this.current_category == 'business') {
        			$('#category-container').removeClass('business')
        			$('#category-container').addClass('technology');
        			$('#category-text').html('technology');
        			this.current_category = 'technology';
        		}

        		else if (this.current_category == 'technology') {
        			$('#category-container').removeClass('technology')
        			$('#category-container').addClass('entertainment');
        			$('#category-text').html('entertainment');
        			this.current_category = 'entertainment';
        		}

        		else {
        			$('#category-container').removeClass('entertainment')
        			$('#category-container').addClass('world');
        			$('#category-text').html('world');
        			this.current_category = 'world';
        		}

        		if ($('.upvote-container').hasClass('upvoted') == true) {
        			$('.upvote-container').removeClass('us world sports business technology entertainment');
        			$('.upvote-text').removeClass('us world sports business technology entertainment');
        			$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			$('.upvote-container').addClass(this.current_category);
        			$('.upvote-text').addClass(this.current_category);
        			$('.upvote-icon').addClass(this.current_category);
        		}
        		else {
        			$('.upvote-container').css('background-color', '#f8f8f8');
        			setTimeout(function() {
        				$('.upvote-container').css('background-color', '#f2f2f2');
        			}, 10);
        		}

        	},

		fn_tap_upvote: function() {

			if ($('.upvote-container').hasClass('upvoted') == true) {

				$('.upvote-container').removeClass('upvoted');

				setTimeout(function() {
        				$('.upvote-container').removeClass('tapped us world sports business technology entertainment');
        				$('.upvote-text').removeClass('us world sports business technology entertainment');
        				$('.upvote-text').html(30);
        				$('.upvote-icon').removeClass('us world sports business technology entertainment');
        			}, 300);
        		}

			else {

				$('.upvote-container').addClass('upvoted');
    				setTimeout(function() {
        				$('.upvote-container').addClass('tapped ' + that.current_category);
        				$('.upvote-text').addClass(that.current_category);
        				$('.upvote-text').html(31);
        				$('.upvote-icon').addClass(that.current_category);
    				}, 300);
			}

		},

	};

	return Upvote;

})(window, document);
<|endoftext|>


<commit_before>'use strict';
/*
 Oressource
 Copyright (C) 2014-2017  Martin Vert and Oressource devellopers

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as
 published by the Free Software Foundation, either version 3 of the
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Affero General Public License for more details.

 You should have received a copy of the GNU Affero General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

function new_state() {
  return {
    moyen: 1,
    ticket: new Ticket(),
    last: undefined,
    vente_unite: true
  };
}

function new_numpad() {
  return {
    prix: 0,
    quantite: 0,
    masse: 0.0
  };
}

function new_rendu() {
  return {
    reglement: 0,
    difference: 0
  };
}

let state = new_state();
let numpad = new_numpad();
let rendu = new_rendu();

let current_focus = document.getElementById('quantite');
function fokus(element) {
  current_focus = element;
}

function ticket_sum(ticket) {
  const f = (acc, vente) =>
    acc + (vente.vente_unite ? vente.prix * vente.quantite : vente.prix);
  return ticket.to_array().reduce(f, 0);
}

function ticket_quantite(ticket) {
  const f = (acc, vente) => acc + vente.quantite;
  return ticket.to_array().reduce(f, 0);
}

function render_numpad( { prix, quantite, masse }) {
  document.getElementById('quantite').value = quantite;
  document.getElementById('prix').value = prix;
  if (window.ventes.pesees) {
    document.getElementById('masse').value = masse;
  }
}

function reset_rendu() {
  rendu = new_rendu();
  update_rendu();
}

function reset_numpad() {
  numpad = new_numpad();
  render_numpad(numpad);
}

function get_numpad() {
  const masseinput = document.getElementById('masse');
  return {
    quantite: Number.parseInt(document.getElementById('quantite').value, 10),
    masse: Number.parseFloat(masseinput === null ? NaN : masseinput.value, 10),
    prix: Number.parseFloat(document.getElementById('prix').value, 10)
  };
}

function update_state( { type, objet = {prix: 0, masse: 0.0} }) {
  numpad.prix = objet.prix;
  numpad.quantite = 1;
  numpad.masse = objet.masse || 0.0;
  state.last = { type, objet };
  const color = objet.couleur || type.couleur;
  const name = objet.nom || type.nom;
  const html = `Objet: <span class='badge' id='cool' style="background-color:${color}">${name}</span>`;
  document.getElementById('nom_objet').innerHTML = html;
  render_numpad(numpad);
}

function reset(data) {
  state = new_state();
  reset_numpad();
  reset_rendu();
  const range = document.createRange();
  range.selectNodeContents(document.getElementById('transaction'));
  range.deleteContents();
  update_recap(ticket_sum(state.ticket), ticket_quantite(state.ticket));
  data.json().then(data => {
    document.getElementById('num_vente').textContent = data.id_vente + 1;
  });
}

function moyens(methode) {
  state.methode = methode;
}

function encaisse_vente(event) {
  event.preventDefault();
  if (state.ticket.size > 0) {
    const url = '../api/ventes.php';
    const date = document.getElementById('date');
    const data = {
      id_point: window.ventes.point.id,
      id_user: window.ventes.id_user,
      id_moyen: state.moyen,
      commentaire: document.getElementById('commentaire').value.trim(),
      items: state.ticket.to_array()
    };
    if (date !== null) {
      data.date = date.value;
    }
    post_data(url, data, reset);
  }
}

function print() {
  if (state.ticket.size > 0) {
    const f = () => {
      if (ventes.tva_active) {
        const prixtot = ticket_sum(state.ticket).toFixed(2);
        const ptva = prixtot * ventes.taux_tva.toFixed(2);
        const prixht = (prixtot - ptva).toFixed(2);
        return `TVA à ${ventes.taux_tva}% Prix H.T. = ${prixht} + € TVA =  ${ptva} €`;
      } else {
        return "Association non assujettie à la TVA.";
      }
    };
    const commentaire = document.getElementById('commentaire').value.strip();
    const newstr = document.getElementById('ticket').innerHTML;
    const oldstr = document.body.innerHTML;
    document.body.innerHTML = `<title>Ticket</title>

${commentaire}

${newstr}${f()}`;
    window.print();
    document.body.innerHTML = oldstr;
    encaisse();
  }
}

function update_rendu() {
  const total = ticket_sum(state.ticket);
  const input = document.getElementById('reglement');
  rendu.reglement = parseFloat(input.value, 10).toFixed(3);
  rendu.difference = rendu.reglement - total;
  document.getElementById('somme').value = total;
  document.getElementById('difference').value = rendu.difference || 0;
}

function numpad_input(elem) {
  current_focus.value += elem.value;
}

function remove(id) {
  const elem = state.ticket.remove(id);
  document.getElementById(id).remove();
  update_recap(ticket_quantite(state.ticket), ticket_sum(state.ticket));
  update_rendu();
  reset_numpad();
}

function update_recap(total, size) {
  document.getElementById('total').innerHTML = `<li class="list-group-item">Soit : ${size} article(s) pour : <span class="badge" style="float:right;">${total.toFixed(2)} €</span></li>`;
  document.getElementById('recaptotal').innerHTML = total.toFixed(2) + ' €';
  document.getElementById('nom_objet').textContent = "Objet:";
}

function add() {
  if (state.last !== undefined) {
    const { prix, quantite, masse } = get_numpad();
    if (quantite > 0 && !isNaN(prix)) {
      const current = state.last;
      state.last = undefined;
      const vente = {
        id_type: current.type.id,
        id_objet: current.objet.id || null,
        lot: !state.vente_unite,
        quantite,
        prix,
        masse
      };
      const id = state.ticket.push(vente);

      const name = current.objet.nom || current.type.nom;
      const li = document.createElement('li');
      li.setAttribute('id', id);
      li.setAttribute('class', 'list-group-item');
      const amount = vente.vente_unite ? vente.prix * vente.quantite : vente.prix;
      let html = `
            ${amount.toFixed(2)} €

               ${quantite} × ${name}`;
      if (masse > 0 && window.ventes.pesees) {
        html += `, ${(masse * quantite).toFixed(3)} Kgs.`;
      }
      li.innerHTML = html;
      document.getElementById('transaction').appendChild(li);
      update_recap(ticket_sum(state.ticket), ticket_quantite(state.ticket));
      update_rendu();
      reset_numpad();
    } else {
      this.input.setCustomValidity('Quantite nulle ou inferieur a 0.');
    }
  }
}

document.addEventListener('DOMContentLoaded', () => {
  $("#typeVente").bootstrapSwitch();
  $("#typeVente").on('switchChange.bootstrapSwitch', (event, checked) => {
    const lot_or_unite = (label, prix_string, masse_string, bg_color) => {
      document.getElementById('labellot').textContent = label;
      document.getElementById('labelprix').textContent = prix_string;
      document.getElementById('panelcalc').style.backgroundColor = bg_color;
      if (window.ventes.pesees) {
        document.getElementById('labelmasse').textContent = masse_string;
      }
    };
    if (checked) {
      lot_or_unite("Vente à: ", "Prix unitaire:", "Masse unitaire: ", "white");
    } else {
      lot_or_unite("Vente au: ", "Prix du lot: ", "Masse du lot: ", "#E8E6BC");
    }
    state.vente_unite = checked;
  });

  document.getElementById('reload').addEventListener('click', () => window.location.reload(), false);
  document.getElementById('encaissement').addEventListener('click', encaisse_vente, false);
  document.getElementById('impression').addEventListener('click', () => print, false);
}, false);<commit_msg>Dans les ventes sur l'interface de saisie si le nom est trop long on coupe.<commit_after>'use strict';
/*
 Oressource
 Copyright (C) 2014-2017  Martin Vert and Oressource devellopers

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as
 published by the Free Software Foundation, either version 3 of the
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Affero General Public License for more details.

 You should have received a copy of the GNU Affero General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

function new_state() {
  return {
    moyen: 1,
    ticket: new Ticket(),
    last: undefined,
    vente_unite: true
  };
}

function new_numpad() {
  return {
    prix: 0,
    quantite: 0,
    masse: 0.0
  };
}

function new_rendu() {
  return {
    reglement: 0,
    difference: 0
  };
}

const wrapString = (s, n, c) => (s.length > n) ? (s.slice(0, n) + c) : s;

let state = new_state();
let numpad = new_numpad();
let rendu = new_rendu();

let current_focus = document.getElementById('quantite');
function fokus(element) {
  current_focus = element;
}

function ticket_sum(ticket) {
  const f = (acc, vente) =>
    acc + (vente.vente_unite ? vente.prix * vente.quantite : vente.prix);
  return ticket.to_array().reduce(f, 0);
}

function ticket_quantite(ticket) {
  const f = (acc, vente) => acc + vente.quantite;
  return ticket.to_array().reduce(f, 0);
}

function render_numpad( { prix, quantite, masse }) {
  document.getElementById('quantite').value = quantite;
  document.getElementById('prix').value = prix;
  if (window.ventes.pesees) {
    document.getElementById('masse').value = masse;
  }
}

function reset_rendu() {
  rendu = new_rendu();
  update_rendu();
}

function reset_numpad() {
  numpad = new_numpad();
  render_numpad(numpad);
}

function get_numpad() {
  const masseinput = document.getElementById('masse');
  return {
    quantite: Number.parseInt(document.getElementById('quantite').value, 10),
    masse: Number.parseFloat(masseinput === null ? NaN : masseinput.value, 10),
    prix: Number.parseFloat(document.getElementById('prix').value, 10)
  };
}

function update_state( { type, objet = {prix: 0, masse: 0.0} }) {
  numpad.prix = objet.prix;
  numpad.quantite = 1;
  numpad.masse = objet.masse || 0.0;
  state.last = { type, objet };
  const color = objet.couleur || type.couleur;
  const name = objet.nom || type.nom;
  const html = `<span class='badge' id='cool' style="background-color:${color}">${wrapString(name, 15, '…')}</span>`;
  document.getElementById('nom_objet').innerHTML = html;
  render_numpad(numpad);
}

function reset(data) {
  state = new_state();
  reset_numpad();
  reset_rendu();
  const range = document.createRange();
  range.selectNodeContents(document.getElementById('transaction'));
  range.deleteContents();
  update_recap(ticket_sum(state.ticket), ticket_quantite(state.ticket));
  data.json().then(data => {
    document.getElementById('num_vente').textContent = data.id_vente + 1;
  });
}

function moyens(methode) {
  state.methode = methode;
}

function encaisse_vente(event) {
  event.preventDefault();
  if (state.ticket.size > 0) {
    const url = '../api/ventes.php';
    const date = document.getElementById('date');
    const data = {
      id_point: window.ventes.point.id,
      id_user: window.ventes.id_user,
      id_moyen: state.moyen,
      commentaire: document.getElementById('commentaire').value.trim(),
      items: state.ticket.to_array()
    };
    if (date !== null) {
      data.date = date.value;
    }
    post_data(url, data, reset);
  }
}

function print() {
  if (state.ticket.size > 0) {
    const f = () => {
      if (ventes.tva_active) {
        const prixtot = ticket_sum(state.ticket).toFixed(2);
        const ptva = prixtot * ventes.taux_tva.toFixed(2);
        const prixht = (prixtot - ptva).toFixed(2);
        return `TVA à ${ventes.taux_tva}% Prix H.T. = ${prixht} + € TVA =  ${ptva} €`;
      } else {
        return "Association non assujettie à la TVA.";
      }
    };
    const commentaire = document.getElementById('commentaire').value.strip();
    const newstr = document.getElementById('ticket').innerHTML;
    const oldstr = document.body.innerHTML;
    document.body.innerHTML = `<title>Ticket</title>

${commentaire}

${newstr}${f()}`;
    window.print();
    document.body.innerHTML = oldstr;
    encaisse();
  }
}

function update_rendu() {
  const total = ticket_sum(state.ticket);
  const input = document.getElementById('reglement');
  rendu.reglement = parseFloat(input.value, 10).toFixed(3);
  rendu.difference = rendu.reglement - total;
  document.getElementById('somme').value = total;
  document.getElementById('difference').value = rendu.difference || 0;
}

function numpad_input(elem) {
  current_focus.value += elem.value;
}

function remove(id) {
  const elem = state.ticket.remove(id);
  document.getElementById(id).remove();
  update_recap(ticket_quantite(state.ticket), ticket_sum(state.ticket));
  update_rendu();
  reset_numpad();
}

function update_recap(total, size) {
  document.getElementById('total').innerHTML = `<li class="list-group-item">Soit : ${size} article(s) pour : <span class="badge" style="float:right;">${total.toFixed(2)} €</span></li>`;
  document.getElementById('recaptotal').innerHTML = total.toFixed(2) + ' €';
  document.getElementById('nom_objet').textContent = "Objet:";
}

function add() {
  if (state.last !== undefined) {
    const { prix, quantite, masse } = get_numpad();
    if (quantite > 0 && !isNaN(prix)) {
      const current = state.last;
      state.last = undefined;
      const vente = {
        id_type: current.type.id,
        id_objet: current.objet.id || null,
        lot: !state.vente_unite,
        quantite,
        prix,
        masse
      };
      const id = state.ticket.push(vente);

      const name = current.objet.nom || current.type.nom;
      const li = document.createElement('li');
      li.setAttribute('id', id);
      li.setAttribute('class', 'list-group-item');
      const amount = vente.vente_unite ? vente.prix * vente.quantite : vente.prix;
      let html = `
            ${amount.toFixed(2)} €

               ${quantite} × ${name}`;
      if (masse > 0 && window.ventes.pesees) {
        html += `, ${(masse * quantite).toFixed(3)} Kgs.`;
      }
      li.innerHTML = html;
      document.getElementById('transaction').appendChild(li);
      update_recap(ticket_sum(state.ticket), ticket_quantite(state.ticket));
      update_rendu();
      reset_numpad();
    } else {
      this.input.setCustomValidity('Quantite nulle ou inferieur a 0.');
    }
  }
}

document.addEventListener('DOMContentLoaded', () => {
  $("#typeVente").bootstrapSwitch();
  $("#typeVente").on('switchChange.bootstrapSwitch', (event, checked) => {
    const lot_or_unite = (label, prix_string, masse_string, bg_color) => {
      document.getElementById('labellot').textContent = label;
      document.getElementById('labelprix').textContent = prix_string;
      document.getElementById('panelcalc').style.backgroundColor = bg_color;
      if (window.ventes.pesees) {
        document.getElementById('labelmasse').textContent = masse_string;
      }
    };
    if (checked) {
      lot_or_unite("Vente à: ", "Prix unitaire:", "Masse unitaire: ", "white");
    } else {
      lot_or_unite("Vente au: ", "Prix du lot: ", "Masse du lot: ", "#E8E6BC");
    }
    state.vente_unite = checked;
  });

  document.getElementById('reload').addEventListener('click', () => window.location.reload(), false);
  document.getElementById('encaissement').addEventListener('click', encaisse_vente, false);
  document.getElementById('impression').addEventListener('click', () => print, false);
}, false);<|endoftext|>


<commit_before>'use strict'

const path = require('path')
const gulp = require('gulp')
const karmaConfig = require('karma').config
const Server = require('karma').Server
const tape = require('gulp-tape')
const tapSpec = require('tap-spec')
const config = require('../config').test

gulp.task('test:gulpTasks', gulp.series('lint:gulpTasks', () => gulp.src(config.gulpTasks)
  .pipe(tape({
    bail: true,
    reporter: tapSpec()
  }))))

gulp.task('test:v3', (done) => {
  const v3KarmaConfig = karmaConfig.parseConfig(
    path.resolve(config.karmaConfig),
    { files: config.files.v3 }
  )

  const server = new Server(
    v3KarmaConfig,
    (exitCode) => {
      done(exitCode)
    }
  )

  server.start()
})

gulp.task('test:v4', (done) => {
  const v4KarmaConfig = karmaConfig.parseConfig(
    path.resolve(config.karmaConfig),
    { files: config.files.v4 }
  )

  const server = new Server(
    v4KarmaConfig,
    (exitCode) => {
      done(exitCode)
    }
  )

  server.start()
})

gulp.task('test', gulp.parallel('style', 'images', 'svg', 'test:v3', 'test:v4'))
<commit_msg>Fixing sequential build steps.<commit_after>'use strict'

const path = require('path')
const gulp = require('gulp')
const karmaConfig = require('karma').config
const Server = require('karma').Server
const tape = require('gulp-tape')
const tapSpec = require('tap-spec')
const config = require('../config').test

gulp.task('test:gulpTasks', gulp.series('lint:gulpTasks', () => gulp.src(config.gulpTasks)
  .pipe(tape({
    bail: true,
    reporter: tapSpec()
  }))))

gulp.task('test:v3', (done) => {
  const v3KarmaConfig = karmaConfig.parseConfig(
    path.resolve(config.karmaConfig),
    { files: config.files.v3 }
  )

  const server = new Server(
    v3KarmaConfig,
    (exitCode) => {
      done(exitCode)
    }
  )

  server.start()
})

gulp.task('test:v4', (done) => {
  const v4KarmaConfig = karmaConfig.parseConfig(
    path.resolve(config.karmaConfig),
    { files: config.files.v4 }
  )

  const server = new Server(
    v4KarmaConfig,
    (exitCode) => {
      done(exitCode)
    }
  )

  server.start()
})

gulp.task('test', gulp.series(gulp.parallel('style', 'images', 'svg'), gulp.parallel('test:v3', 'test:v4')))
<|endoftext|>


<commit_before>/**
 * Audio Player
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the LICENSE.md file.
 *
 * @author Marcel Scherello <audioplayer@scherello.de>
 * @author Sebastian Doell <sebastian@libasys.de>
 * @copyright 2016-2017 Marcel Scherello
 * @copyright 2015 Sebastian Doell
 */

var audioPlayer = {
	mime : null,
	file : null,
	location : null,
	player : null,
	dir: null,
	onView : function(file, data) {
		file = encodeURIComponent(file);
		audioPlayer.file = file;
		audioPlayer.dir = data.dir;
		//sharingToken
		var token = ($('#sharingToken').val() !== undefined) ? $('#sharingToken').val() : '';
		//.thumbnail
		var dirLoad=data.dir.substr(1);
		if(dirLoad!=''){
			dirLoad=dirLoad+'/';
		}
		if(token !== ''){
			audioPlayer.location = OC.generateUrl('apps/audioplayer/getpublicaudiostream?file={file}&token={token}',{'file':dirLoad+file,'token':token},{escape:false});
		}else{
			audioPlayer.location = OC.generateUrl('apps/audioplayer/getaudiostream?file={file}',{'file':dirLoad+file},{escape:false});

		}
		audioPlayer.mime = data.$file.attr('data-mime');
		data.$file.find('.thumbnail').html('');

		if(audioPlayer.player == null){
			soundManager.setup({
			  url:OC.filePath('audioplayer', 'js', 'soundmanager2.swf'),
		  onready: function() {
			    audioPlayer.player = soundManager.createSound({
			      id:data.$file.attr('data-id'),
			      url: audioPlayer.location
			    });

			    	audioPlayer.player.play();

			  },
			  ontimeout: function() {
			    // Hrmm, SM2 could not start. Missing SWF? Flash blocked? Show an error, etc.?
			  }
			});
		}else{
			audioPlayer.player.stop();
			$('#filestable').find('.thumbnail i.ioc-volume-up').hide();
			//$('#filestable').find('.thumbnail i.ioc-play').show();
			audioPlayer.player=null;
		}

	},
};
$(document).ready(function() {
	if (OCA.Files && OCA.Files.fileActions) {

	var mime_array = ['audio/mpeg', 'audio/mp4', 'audio/m4b', 'audio/ogg', 'audio/wav'];

		for (var i=0; i<mime_array.length; i++) {

			OCA.Files.fileActions.registerAction({
				name: 'audioplayer play',
				displayName: t('audioplayer', 'Play'),
				mime: mime_array[i],
				permissions: OC.PERMISSION_READ,
				icon: function () {return OC.imagePath('core', 'actions/sound');},
				actionHandler: audioPlayer.onView
			});

			OCA.Files.fileActions.register(mime_array[i], 'View', OC.PERMISSION_READ, '', audioPlayer.onView);
			OCA.Files.fileActions.setDefault(mime_array[i], 'View');

		}//end mime-loop

		if($('#header').hasClass('share-file')){

			var token = ($('#sharingToken').val() !== undefined) ? $('#sharingToken').val() : '';
			var mimeType=$('#mimetype').val();
			if(mime_array.indexOf(mimeType) !== -1){

			OC.addStyle('audioplayer','360player');
			OC.addStyle('audioplayer','360player-visualization');

			setTimeout(function(){ $('.publicpreview').css({'margin-top':'0px'}); }, 2000);
			$('#imgframe').css({'max-width':'250px'});
			$('#imgframe').css({'margin-bottom':'0px'});

			if( $('#previewSupported').val() !== 'true'){
				$('#imgframe').hide();
			}
			var fileName=$('#filename').val();
			fileName = encodeURIComponent(fileName);
			var audioUrl= OC.generateUrl('apps/audioplayer/getpublicaudiostream{file}?token={token}',{'file':fileName,'token':token},{escape:false});
			var audioContainer=$('
').attr('id','sm2-container');

			$('#preview').before(audioContainer);
			var audioOuterDiv=$('
').addClass('outer-audioplayer').css('clear','both');
			var audioInnerDiv=$('
').addClass('ui360 ui360-vis');
			var audioLink=$('').attr({
				'href':audioUrl
			}).text($('#filename').val()).css('visibility','hidden');
			audioInnerDiv.append(audioLink);
			audioOuterDiv.append(audioInnerDiv);
			audioContainer.append(audioOuterDiv);
			OC.addScript('audioplayer','berniecode-animator',function(){
				OC.addScript('audioplayer','360player',function(){
					soundManager.setup({
					  url:'./apps/audioplayer/js/',
					 });

				});
			});

			$('#imgframe').before($('
').attr('id','id3'));
				url = OC.generateUrl('apps/audioplayer/getpublicaudioinfo{file}?token={token}',{'file':fileName,'token':token},{escape:false});

				$.ajax({
					type : 'GET',
					url : url,
					success : function(jsondata) {
						if(jsondata.status == 'success'){
							var playlistsdata=jsondata.data;
							//$(".directLink").remove();
							//$(".directDownload").remove();
							$('#content-wrapper').css({'padding-top':'0px'});
							$('#id3').append('

');
							$('#id3').append('
'+t('audioplayer','Title')+': '+ jsondata.data.title +'
');
							$('#id3').append('
'+t('audioplayer','Artist')+': '+ jsondata.data.artist +'
');
							$('#id3').append('
'+t('audioplayer','Album')+': '+ jsondata.data.album +'
');
							$('#id3').append('
'+t('audioplayer','Genre')+': '+ jsondata.data.genre +'
');
							$('#id3').append('
'+t('audioplayer','Year')+': '+ jsondata.data.year +'
');
							$('#id3').append('
'+t('audioplayer','Length')+': '+ jsondata.data.length +'
');
							$('#id3').append('
'+t('audioplayer','Bitrate')+': '+ jsondata.data.bitrate +' kbps
');
							//$('#id3').append('
'+t('audioplayer','Composer')+': '+ jsondata.data.composer +'
');
							$('#imgframe').css({'padding-top':'20px'});
							$('#imgframe').css({'padding-bottom':'0px'});
							$('.directDownload').css({'padding-top':'20px'});
							$('.directLink').css({'padding-top':'0px'});
						}
					}
				});
		}

		}
		//$(document).keydown(videoCoolViewer.onKeyDown);
	}
});
<commit_msg>shareplayer url for single file incorrect<commit_after>/**
 * Audio Player
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the LICENSE.md file.
 *
 * @author Marcel Scherello <audioplayer@scherello.de>
 * @author Sebastian Doell <sebastian@libasys.de>
 * @copyright 2016-2017 Marcel Scherello
 * @copyright 2015 Sebastian Doell
 */

var audioPlayer = {
	mime : null,
	file : null,
	location : null,
	player : null,
	dir: null,
	onView : function(file, data) {
		file = encodeURIComponent(file);
		audioPlayer.file = file;
		audioPlayer.dir = data.dir;
		//sharingToken
		var token = ($('#sharingToken').val() !== undefined) ? $('#sharingToken').val() : '';
		//.thumbnail
		var dirLoad=data.dir.substr(1);
		if(dirLoad!=''){
			dirLoad=dirLoad+'/';
		}
		if(token !== ''){
			audioPlayer.location = OC.generateUrl('apps/audioplayer/getpublicaudiostream?token={token}&file={file}',{'token':token, 'file':dirLoad+file},{escape:false});
		}else{
			audioPlayer.location = OC.generateUrl('apps/audioplayer/getaudiostream?file={file}',{'file':dirLoad+file},{escape:false});

		}
		audioPlayer.mime = data.$file.attr('data-mime');
		data.$file.find('.thumbnail').html('');

		if(audioPlayer.player == null){
			soundManager.setup({
			  url:OC.filePath('audioplayer', 'js', 'soundmanager2.swf'),
		  onready: function() {
			    audioPlayer.player = soundManager.createSound({
			      id:data.$file.attr('data-id'),
			      url: audioPlayer.location
			    });

			    	audioPlayer.player.play();

			  },
			  ontimeout: function() {
			    // Hrmm, SM2 could not start. Missing SWF? Flash blocked? Show an error, etc.?
			  }
			});
		}else{
			audioPlayer.player.stop();
			$('#filestable').find('.thumbnail i.ioc-volume-up').hide();
			//$('#filestable').find('.thumbnail i.ioc-play').show();
			audioPlayer.player=null;
		}

	},
};
$(document).ready(function() {
	if (OCA.Files && OCA.Files.fileActions) {

	var mime_array = ['audio/mpeg', 'audio/mp4', 'audio/m4b', 'audio/ogg', 'audio/wav'];

		for (var i=0; i<mime_array.length; i++) {

			OCA.Files.fileActions.registerAction({
				name: 'audioplayer play',
				displayName: t('audioplayer', 'Play'),
				mime: mime_array[i],
				permissions: OC.PERMISSION_READ,
				icon: function () {return OC.imagePath('core', 'actions/sound');},
				actionHandler: audioPlayer.onView
			});

			OCA.Files.fileActions.register(mime_array[i], 'View', OC.PERMISSION_READ, '', audioPlayer.onView);
			OCA.Files.fileActions.setDefault(mime_array[i], 'View');

		}//end mime-loop

		if($('#header').hasClass('share-file')){

			var token = ($('#sharingToken').val() !== undefined) ? $('#sharingToken').val() : '';
			var mimeType=$('#mimetype').val();
			if(mime_array.indexOf(mimeType) !== -1){

			OC.addStyle('audioplayer','360player');
			OC.addStyle('audioplayer','360player-visualization');

			setTimeout(function(){ $('.publicpreview').css({'margin-top':'0px'}); }, 2000);
			$('#imgframe').css({'max-width':'250px'});
			$('#imgframe').css({'margin-bottom':'0px'});

			if( $('#previewSupported').val() !== 'true'){
				$('#imgframe').hide();
			}
			var fileName=$('#filename').val();
			fileName = encodeURIComponent(fileName);
			var audioUrl= OC.generateUrl('apps/audioplayer/getpublicaudiostream?token={token}&file={file}',{'token':token, 'file':fileName},{escape:false});
			var audioContainer=$('
').attr('id','sm2-container');

			$('#preview').before(audioContainer);
			var audioOuterDiv=$('
').addClass('outer-audioplayer').css('clear','both');
			var audioInnerDiv=$('
').addClass('ui360 ui360-vis');
			var audioLink=$('').attr({
				'href':audioUrl
			}).text($('#filename').val()).css('visibility','hidden');
			audioInnerDiv.append(audioLink);
			audioOuterDiv.append(audioInnerDiv);
			audioContainer.append(audioOuterDiv);
			OC.addScript('audioplayer','berniecode-animator',function(){
				OC.addScript('audioplayer','360player',function(){
					soundManager.setup({
					  url:'./apps/audioplayer/js/',
					 });

				});
			});

			$('#imgframe').before($('
').attr('id','id3'));
				url = OC.generateUrl('apps/audioplayer/getpublicaudioinfo{file}?token={token}',{'file':fileName,'token':token},{escape:false});

				$.ajax({
					type : 'GET',
					url : url,
					success : function(jsondata) {
						if(jsondata.status == 'success'){
							var playlistsdata=jsondata.data;
							//$(".directLink").remove();
							//$(".directDownload").remove();
							$('#content-wrapper').css({'padding-top':'0px'});
							$('#id3').append('

');
							$('#id3').append('
'+t('audioplayer','Title')+': '+ jsondata.data.title +'
');
							$('#id3').append('
'+t('audioplayer','Artist')+': '+ jsondata.data.artist +'
');
							$('#id3').append('
'+t('audioplayer','Album')+': '+ jsondata.data.album +'
');
							$('#id3').append('
'+t('audioplayer','Genre')+': '+ jsondata.data.genre +'
');
							$('#id3').append('
'+t('audioplayer','Year')+': '+ jsondata.data.year +'
');
							$('#id3').append('
'+t('audioplayer','Length')+': '+ jsondata.data.length +'
');
							$('#id3').append('
'+t('audioplayer','Bitrate')+': '+ jsondata.data.bitrate +' kbps
');
							//$('#id3').append('
'+t('audioplayer','Composer')+': '+ jsondata.data.composer +'
');
							$('#imgframe').css({'padding-top':'20px'});
							$('#imgframe').css({'padding-bottom':'0px'});
							$('.directDownload').css({'padding-top':'20px'});
							$('.directLink').css({'padding-top':'0px'});
						}
					}
				});
		}

		}
		//$(document).keydown(videoCoolViewer.onKeyDown);
	}
});
<|endoftext|>