PageSourceSearch

https://fulaordboken.se/Scripts/app.js

js fulaordboken.se collected 2026-10-02 19:55:20 UTC 5,701 bytes, 179 lines download raw bytes

1(function () {
2	$('[data-target="#navbarletters"]').on('click', function (e) {
3		$('#navbar1').collapse('hide');
4	});
5
6	$('[data-target="#navbar1"]').on('click', function (e) {
7		$('#navbarletters').collapse('hide');
8	});
9
10    if ($('textarea').length > 0) {
11		tinymce.init({
12			setup: function (ed) {
13				ed.on('init', function (ed) {
14					this.getDoc().body.style.fontSize = '1rem';
15					this.getDoc().body.style.fontFamily = 'sans-serif';
16					this.getDoc().body.style.margin = "0 0.75rem";
17					this.getDoc().body.style.color =  "#464a4c";
18				});
19			},
20            selector: 'textarea',
21            menubar: false,
22            statusbar: false,
23            toolbar_items_size: 'small',
24			toolbar1: 'bold italic',
25			branding: false,
26			plugins: "autoresize",
27			autoresize_bottom_margin: 0,
28			autoresize_min_height: 250,
29			autoresize_max_height: 500
30        });
31	}
32
33
34	$('.alert-success').delay(3200).fadeOut(300);
35
36	$(window).scroll(function () {
37		if ($(this).scrollTop() > 1340) {
38			$('.back-to-top').fadeIn();
39		} else {
40			$('.back-to-top').fadeOut();
41		}
42	});
43
44	$('.back-to-top').click(function () {
45		$("html, body").animate({ scrollTop: 0 }, 500);
46		return false;
47	});
48
49    var app = angular.module("baseApp", ["ngAnimate"])
50
51    app.controller("SliderController", ["$scope", "$http", "$interval", function ($scope, $http, $interval) {
52        $scope.getSliderWords = function (searchWord, activeWord) {
53            var data = {
54                search: searchWord,
55                activeWord: activeWord || $scope.activeWord,
56                active: true
57            };
58            
59            $http.post('/SliderWords', data)
60                .then(
61                    function (response) {
62                        var data = response.data;
63
64                        $scope.activeWord = data.ActiveWord;
65                        $scope.upSearchWord = data.UpSearchWord;
66                        $scope.downSearchWord = data.DownSearchWord;
67
68
69                        $scope.downWords = data.DownWords;
70                        $scope.downWords.shift()
71
72                        $scope.upWords = data.UpWords;
73                        $scope.upWords.pop();
74                        if(!$scope.activeWords.length > 0)
75                            $scope.activeWords = data.ActiveWords;
76                        
77
78                        console.log(response.data)
79                    },
80                    function (response) {
81                        
82                    }
83                )
84        }
85
86        $scope.up = function (searchWord, activeWord, active) {
87            var upInterval = $interval(function () {
88                if ($scope.upWords.length !== 0) {
89                    var word = $scope.upWords.pop();
90                    $scope.activeWords.unshift(word);
91                }
92                else {
93                    $interval.cancel(upInterval);
94                    do {
95                        $scope.activeWords.pop();
96                    } while ($scope.activeWords.length > 21)
97                    $scope.getSliderWords($scope.upSearchWord)
98                }
99            }, 50);
100        };
101
102        $scope.down = function () {
103            for (var i = 0; i < $scope.downWords.length; i++) {
104                $scope.activeWords.push($scope.downWords[i])
105            }
106            
107            var downInterval = $interval(function () {
108                if ($scope.activeWords.length > 21) {
109                    $scope.activeWords.shift();
110                }
111                else {
112                    $interval.cancel(downInterval);
113                    $scope.getSliderWords($scope.downSearchWord);
114                }
115            }, 50);
116        };
117
118        $scope.init = function (word, data) {
119            $scope.activeWord = word;
120
121            //$scope.activeWord = data.ActiveWord;
122            $scope.activeWords = data.ActiveWords
123            $scope.upSearchWord = data.UpSearchWord;
124            $scope.downSearchWord = data.DownSearchWord;
125
126
127            $scope.downWords = data.DownWords;
128            $scope.downWords.shift()
129
130            $scope.upWords = data.UpWords;
131            $scope.upWords.pop();
132            if (!$scope.activeWords.length > 0)
133                $scope.activeWords = data.ActiveWords;
134
135            //$scope.getSliderWords($scope.activeWord, $scope.activeWord, true);
136        }
137        
138    }]);
139
140    app.controller("SearchController", ['$scope', '$location', function ($scope, $location) {
141        $scope.word = "";
142
143        $scope.search = function () {
144            if ($scope.word !== "") {
145                location.href = "/Ordboken?ord=" + $scope.word;
146            }
147
148            return false;
149        }
150    }]);
151
152    app.directive('resize', ['$window', function ($window) {
153        return function (scope, element, attr) {
154            var w = angular.element($window);
155            scope.$watch(function () {
156                return {
157                    'h': w.height(),
158                    'w': w.width()
159                };
160            }, function (newValue, oldValue) {
161                scope.windowHeight = newValue.h;
162                scope.windowWidth = newValue.w;
163
164                scope.resizeWithOffset = function (offsetH) {
165                    scope.$eval(attr.notifier);
166                    return {
167                        'height': (newValue.h - offsetH) + 'px'
168                    };
169                };
170
171            }, true);
172
173            w.bind('resize', function () {
174                scope.$apply();
175            });
176        }
177    }])
178    
179}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.