<commit_before>'use strict';

/* Directives */

// Create transaction visualisation
var scratch = angular.module('scratch.directives', ['ngRoute']);
scratch.directive('versionInfo', ['version', function(version)
{
	return {
		restrict: 'E',
		link: function(scope, element, attrs)
			{
				element.text(version);
			}
	}
}]);
scratch.directive('loadOnVerticalScroll', ['$document', '$window', function($document, $window)
{
    return {
    	restrict: 'A',
    	scope:
    	{
    		loadingNextPage: '=',
    		loadNextPage: '&',
    		anotherPage: '='
    	},
    	link: function(scope, element, attrs)
    	{

		  // Bind a touch event to enable
		  $document.bind('scroll', function() {

		    var height = $document.height();
		    var location = $document.scrollTop();

		    // If the user has scrolled through 90% of the page and there's another page to load, load it.
		    if(location + $window.innerHeight >= 0.9* height && scope.anotherPage && !scope.loadingNextPage)
		    {
		      	scope.loadNextPage();
		    }

		  });
    	}
  	}
}]);

scratch.directive("loadProjectPage", ["$window", function($window)
{
	return {
		restrict: "A",
		scope: {
			projectSettings: "="
		},
		link: function(scope, element, attrs) {
			element.click(function() {
    			$window.location = "#/project/" + scope.projectSettings.projectId;
			});
		}
	}
}]);

scratch.directive("loadProjectPlayer", ["$window", function($window)
{
	return {
		restrict: "A",
		scope: {
			projectSettings: "="
		},
		link: function(scope, element, attrs) {
			element.click(function(e) {
				e.stopPropagation();
    			$window.location = "/scratch-player/" + scope.projectSettings.projectId + '/#showflags=true&autoplay=false&fullscreen=true';
			});
		}
	}
}]);

scratch.directive('scrollable', ['$window', function($window)
{
	return {
		restrict: 'A',
		scope: {

		},
		link: function(scope, element, attrs)
		{
			// Bind first touch method<commit_msg>Removed / from play button to ensure consistency.<commit_after>'use strict';

/* Directives */

// Create transaction visualisation
var scratch = angular.module('scratch.directives', ['ngRoute']);
scratch.directive('versionInfo', ['version', function(version)
{
	return {
		restrict: 'E',
		link: function(scope, element, attrs)
			{
				element.text(version);
			}
	}
}]);
scratch.directive('loadOnVerticalScroll', ['$document', '$window', function($document, $window)
{
    return {
    	restrict: 'A',
    	scope:
    	{
    		loadingNextPage: '=',
    		loadNextPage: '&',
    		anotherPage: '='
    	},
    	link: function(scope, element, attrs)
    	{

		  // Bind a touch event to enable
		  $document.bind('scroll', function() {

		    var height = $document.height();
		    var location = $document.scrollTop();

		    // If the user has scrolled through 90% of the page and there's another page to load, load it.
		    if(location + $window.innerHeight >= 0.9* height && scope.anotherPage && !scope.loadingNextPage)
		    {
		      	scope.loadNextPage();
		    }

		  });
    	}
  	}
}]);

scratch.directive("loadProjectPage", ["$window", function($window)
{
	return {
		restrict: "A",
		scope: {
			projectSettings: "="
		},
		link: function(scope, element, attrs) {
			element.click(function() {
    			$window.location = "#/project/" + scope.projectSettings.projectId;
			});
		}
	}
}]);

scratch.directive("loadProjectPlayer", ["$window", function($window)
{
	return {
		restrict: "A",
		scope: {
			projectSettings: "="
		},
		link: function(scope, element, attrs) {
			element.click(function(e) {
				e.stopPropagation();
    			$window.location = "/scratch-player/" + scope.projectSettings.projectId + '#showflags=true&autoplay=false&fullscreen=true';
			});
		}
	}
}]);

scratch.directive('scrollable', ['$window', function($window)
{
	return {
		restrict: 'A',
		scope: {

		},
		link: function(scope, element, attrs)
		{
			// Bind first touch method
{'fraction_non_alphanumeric': 0.16927016645326504, 'fraction_numerical': 0.00204865556978233, 'mean_word_length': 3.306504961411246, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5175490', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1297, 'n_words': 255}