Изменения документа Загрузить документ

Редактировал(а) HRlink 30.05.2025

От версии 73.1
отредактировано HRlink
на 15.09.2024
Изменить комментарий: К данной версии нет комментариев
К версии 76.1
отредактировано HRlink
на 30.05.2025
Изменить комментарий: К данной версии нет комментариев

Сводка

Подробности

Свойства страницы
Содержимое
... ... @@ -141,3 +141,83 @@
141 141  == Дальнейшие действия ==
142 142  
143 143  [[Добавьте к документу сотрудников>>https://wiki.myhrlink.ru/bin/view/Main/Кадровик/Документы/Добавить%20в%20документ%20нескольких%20сотрудников%20/]] или отправьте загруженные документы на [[подпись>>https://wiki.myhrlink.ru/bin/view/Main/Кадровик/Документы/Отправить%20документ%20на%20подпись%20/]]
144 +
145 +----
146 +
147 +(% class="box" %)
148 +(((
149 +{{icon name="handshake-o"}}{{/icon}} Оставить заявку на подробное **демо Start Link** можно по [[ссылке>>https://hr.start-link.ru/?utm_source=hr-link&utm_medium=wiki&utm_campaign=main]]
150 +)))
151 +
152 +{{velocity}}
153 +#set($likesKey = $doc.fullName)
154 +#set($likesDoc = $xwiki.getDocument("XWiki.LikesStorage"))
155 +#set($likesObject = $likesDoc.getObject("XWiki.LikesStorageClass", "key", $likesKey))
156 +
157 +#if(!$likesObject)
158 + #set($likesObject = $likesDoc.newObject("XWiki.LikesStorageClass"))
159 + $likesObject.set("key", $likesKey)
160 + $likesObject.set("value", 0)
161 + $xwiki.saveDocument($likesDoc)
162 +#end
163 +
164 +#set($likes = $likesObject.get("value"))
165 +#set($liked = $request.getCookie("liked-$likesKey"))
166 +#set($userLiked = false)
167 +#if("$!liked" == "true")
168 + #set($userLiked = true)
169 +#end
170 +
171 +{{html clean="false"}}
172 +<div id="like-container" style="margin-top:20px; display:flex; align-items:center; gap:10px;">
173 + <button id="like-button" style="cursor:pointer; font-size: 20px; background: none; border: none;" title="Нравится">
174 + <span id="heart" style="color:#e74c3c;">❤️</span>
175 + </button>
176 + <span id="like-count" style="font-size:18px;">$likes</span>
177 + <span style="font-size:14px; color: #555;">Нравится статья?</span>
178 +</div>
179 +<script>
180 + document.addEventListener('DOMContentLoaded', function () {
181 + const key = "$likesKey";
182 + const likeButton = document.getElementById('like-button');
183 + const likeCount = document.getElementById('like-count');
184 +
185 + function setCookie(name, value, days) {
186 + const d = new Date();
187 + d.setTime(d.getTime() + (days*24*60*60*1000));
188 + document.cookie = name + "=" + value + "; expires=" + d.toUTCString() + "; path=/";
189 + }
190 +
191 + function getCookie(name) {
192 + const value = `; ${document.cookie}`;
193 + const parts = value.split(`; ${name}=`);
194 + if (parts.length === 2) return parts.pop().split(';').shift();
195 + }
196 +
197 + if (getCookie("liked-" + key) === "true") {
198 + likeButton.disabled = true;
199 + likeButton.style.opacity = 0.6;
200 + }
201 +
202 + likeButton.addEventListener('click', function () {
203 + if (getCookie("liked-" + key) !== "true") {
204 + fetch(window.location.href + "?like=1", { method: 'GET' })
205 + .then(() => {
206 + let current = parseInt(likeCount.innerText);
207 + likeCount.innerText = current + 1;
208 + setCookie("liked-" + key, "true", 365);
209 + likeButton.disabled = true;
210 + likeButton.style.opacity = 0.6;
211 + });
212 + }
213 + });
214 + });
215 +</script>
216 +{{/html}}
217 +
218 +#if($request.getParameter("like") == "1")
219 + #set($likes = $likesObject.get("value"))
220 + $likesObject.set("value", $math.add($likes, 1))
221 + $xwiki.saveDocument($likesDoc)
222 +#end
223 +{{/velocity}}