-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
174 lines (163 loc) · 4.64 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
const { createApp } = Vue;
/**
* csoki beállítás
*/
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for(let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
/**
* user jováhagyás kérés popup ablakban
*/
function popupConfirm(txt, yesfun) {
document.getElementById('popupOkBtn').style.display="inline-block";
document.getElementById('popupNoBtn').style.display='inline-block';
document.getElementById('popup').className='popupSimple';
document.getElementById('popupTxt').innerHTML = txt;
document.getElementById('popupOkBtn').onclick=yesfun;
document.getElementById('popup').style.display='block';
}
/**
* poup ablak bezárása
*/
function popupClose() {
document.getElementById('popup').style.display='none';
}
/**
* popup üzenet
*/
function popupMsg(txt,className) {
if (className == undefined) {
className = 'popupSimple';
}
document.getElementById('popupOkBtn').style.display="none";
document.getElementById('popupNoBtn').style.display='none';
document.getElementById('popup').className=className;
document.getElementById('popupTxt').innerHTML = txt;
document.getElementById('popup').style.display='block';
}
/**
* nyelvi fordítás
*/
function lng(token) {
var result = token;
var w = token.split('<br>');
for (var i = 0; i < w.length; i++) {
if (tokens[w[i]] != undefined) {
w[i] = tokens[w[i]];
}
}
result = w.join('<br>');
return result;
}
/**
* felső menüben almenü megjelenés/elrejtés
*/
function submenuToggle() {
var submenu = document.getElementById('submenu');
if (submenu.style.display == 'block') {
submenu.style.display = 'none';
} else {
submenu.style.display = 'block';
}
}
/**
* seo barát url képzéshez segéd rutin
* @param string task
* @param object params {name:value,...}
*/
function HREF(task, params) {
var result = siteurl;
if (rewrite) {
result += '/task/'+task;
for (var fn in params) {
result += '/'+fn+'/'+params[fn];
}
} else {
result += '?task='+task;
for (var fn in params) {
result += '&'+fn+'='+params[fn];
}
}
return result;
}
// Scroll to top(fel a tetejere funkcio)
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
let mybutton = document.getElementById("scrolltotop");
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
// Make the DIV element draggable:
function dragElement(elmnt) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
elmnt.cursor='move';
/*
if (document.getElementById(elmnt.id + "header")) {
// if present, the header is where you move the DIV from:
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
} else {
// otherwise, move the DIV from anywhere inside the DIV:
}
*/
elmnt.onmousedown = dragMouseDown;
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
elmnt.style.cursor = 'crosshair';
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
elmnt.style.cursor = 'move';
}
}
// képernyő méretek tárolása csokiba
setCookie('screen_width',screen.width,100);
setCookie('screen_height',screen.height,100);