redmine_apijs 6.3.0 → 6.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +1 -1
- data/app/controllers/apijs_controller.rb +38 -5
- data/app/views/attachments/_links.html.erb +31 -24
- data/app/views/settings/_apijs.html.erb +6 -2
- data/assets/javascripts/apijs-redmine.min.js +1 -1
- data/assets/javascripts/apijs.min.js +2 -2
- data/assets/javascripts/app.js +118 -43
- data/assets/stylesheets/apijs-print.min.css +1 -1
- data/assets/stylesheets/apijs-redmine-rtl.min.css +1 -1
- data/assets/stylesheets/apijs-redmine.min.css +1 -1
- data/assets/stylesheets/apijs-screen-rtl.min.css +1 -1
- data/assets/stylesheets/apijs-screen.min.css +1 -1
- data/assets/stylesheets/styles.css +3 -2
- data/config/locales/cs.yml +2 -0
- data/config/locales/de.yml +2 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/ja.yml +2 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/pt-BR.yml +2 -0
- data/config/locales/pt.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/tr.yml +2 -0
- data/config/locales/zh.yml +2 -0
- data/config/routes.rb +10 -3
- data/init.rb +5 -4
- data/lib/apijs_attachment.rb +7 -3
- data/lib/redmine_apijs.rb +6 -4
- data/lib/useragentparser.rb +3 -3
- data/lib/video.py +3 -3
- data/redmine_apijs.gemspec +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f0e0e66ed30a6a4f5627a81a61c66b5304fa6110c29a650a2f66c278ba0d6a
|
4
|
+
data.tar.gz: 7e83933fb79ab34635a11a5ee4acece551ab2d2e78e301bf071f902158c0c4c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52297b53f8bf05dc0cf18c925d5c6b0a1093a4d82e79b7a313fb0376a55c89d19bac072a0a914995f21316a0a005c97eeed5929bacbe499ee4ea2d8f3b7b8312
|
7
|
+
data.tar.gz: 0704cee3e63c573ed2d15393b0ec0d2b9890e2f9ec97a8909d97d4edc9ce27a02fc423c0eb911e682af7b93da75ccadd7ca205c9b7f86fbfa1153cbce38700ed
|
data/README
CHANGED
@@ -64,7 +64,7 @@ If you like, take some of your time to improve the translations, go to https://b
|
|
64
64
|
|
65
65
|
|
66
66
|
File: /lib/useragentparser.rb
|
67
|
-
Source: https://github.com/donatj/PhpUserAgent + https://gist.github.com/luigifab/19a68d9aa98fa80f2961809d7cec59c0 (1.
|
67
|
+
Source: https://github.com/donatj/PhpUserAgent + https://gist.github.com/luigifab/19a68d9aa98fa80f2961809d7cec59c0 (1.1.0-fork1)
|
68
68
|
Copyright: 2013-2020 Jesse G. Donat <donatj~gmail~com>
|
69
69
|
Copyright: 2019-2020 Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
70
70
|
License: MIT (https://opensource.org/licenses/mit)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# Created J/12/12/2013
|
3
|
-
# Updated D/
|
3
|
+
# Updated D/27/09/2020
|
4
4
|
#
|
5
5
|
# Copyright 2008-2020 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
6
6
|
# https://www.luigifab.fr/redmine/apijs
|
@@ -21,12 +21,12 @@ class ApijsController < AttachmentsController
|
|
21
21
|
before_action :find_project, except: [:upload]
|
22
22
|
before_action :authorize_global, only: [:upload]
|
23
23
|
before_action :read_authorize, :file_readable, only: [:thumb, :show, :download, :thumbnail]
|
24
|
-
before_action :read_authorize, only: [:editdesc, :delete]
|
24
|
+
before_action :read_authorize, only: [:editdesc, :editname, :delete]
|
25
25
|
else
|
26
26
|
before_filter :find_project, except: [:upload]
|
27
27
|
before_filter :authorize_global, only: [:upload]
|
28
28
|
before_filter :read_authorize, :file_readable, only: [:thumb, :show, :download, :thumbnail]
|
29
|
-
before_filter :read_authorize, only: [:editdesc, :delete]
|
29
|
+
before_filter :read_authorize, only: [:editdesc, :editname, :delete]
|
30
30
|
end
|
31
31
|
|
32
32
|
# n'existe plus avec Redmine 3+ (copie de 2.6.10)
|
@@ -274,13 +274,13 @@ class ApijsController < AttachmentsController
|
|
274
274
|
end
|
275
275
|
|
276
276
|
|
277
|
-
# #### Modification d'une description
|
277
|
+
# #### Modification d'une description ou du nom du fichier ########################### #
|
278
278
|
# » Vérifie si l'utilisateur a accès au projet et à la modification
|
279
279
|
# » Renvoie l'id du fichier suivi de la description en cas de modification réussie
|
280
280
|
# » Supprime certains caractères de la description avant son enregistrement
|
281
281
|
def editdesc
|
282
282
|
|
283
|
-
@attachment.description = params[:
|
283
|
+
@attachment.description = params[:desc].gsub(/["\\\x0]/, '')
|
284
284
|
@attachment.description.strip!
|
285
285
|
|
286
286
|
# vérification d'accès
|
@@ -299,6 +299,39 @@ class ApijsController < AttachmentsController
|
|
299
299
|
end
|
300
300
|
end
|
301
301
|
|
302
|
+
def editname
|
303
|
+
|
304
|
+
name = params[:name].gsub(/["\\\x0]/, '')
|
305
|
+
name = File.basename(name)
|
306
|
+
|
307
|
+
if File.extname(name).downcase != File.extname(@attachment.filename).downcase
|
308
|
+
if Rails::VERSION::MAJOR >= 5
|
309
|
+
render(plain: l(:apijs_check_extension))
|
310
|
+
else
|
311
|
+
render(text: l(:apijs_check_extension))
|
312
|
+
end
|
313
|
+
return
|
314
|
+
end
|
315
|
+
|
316
|
+
@attachment.filename = name
|
317
|
+
@attachment.filename.strip!
|
318
|
+
|
319
|
+
# vérification d'accès
|
320
|
+
if !User.current.allowed_to?({controller: 'projects', action: 'show'}, @project) || !User.current.allowed_to?(:rename_attachments, @project)
|
321
|
+
deny_access
|
322
|
+
# modification
|
323
|
+
elsif @attachment.save
|
324
|
+
if Rails::VERSION::MAJOR >= 5
|
325
|
+
render(plain: 'attachmentId' + @attachment.id.to_s + ':' + @attachment.filename)
|
326
|
+
else
|
327
|
+
render(text: 'attachmentId' + @attachment.id.to_s + ':' + @attachment.filename)
|
328
|
+
end
|
329
|
+
# en cas d'erreur
|
330
|
+
else
|
331
|
+
render_validation_errors(@attachment)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
302
335
|
|
303
336
|
# #### Suppression d'un fichier ###################################################### #
|
304
337
|
# » Vérifie si l'utilisateur a accès au projet et à la suppresion
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
# Created L/21/05/2012
|
3
|
-
# Updated
|
3
|
+
# Updated J/20/08/2020
|
4
4
|
#
|
5
5
|
# Copyright 2008-2020 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
6
6
|
# https://www.luigifab.fr/redmine/apijs
|
@@ -25,6 +25,7 @@ setting_show_album_infos = Setting.plugin_redmine_apijs['show_album_infos'] == '
|
|
25
25
|
setting_show_filename = Setting.plugin_redmine_apijs['show_filename'] == '1'
|
26
26
|
setting_show_exifdate = Setting.plugin_redmine_apijs['show_exifdate'] == '1'
|
27
27
|
permission_delete = User.current.allowed_to?(:delete_attachments, @project)
|
28
|
+
permission_rename = User.current.allowed_to?(:rename_attachments, @project)
|
28
29
|
permission_edit = User.current.allowed_to?(:edit_attachments, @project)
|
29
30
|
|
30
31
|
@slideshowi = 0 unless defined? @slideshowi
|
@@ -54,7 +55,7 @@ end
|
|
54
55
|
<dl id="attachmentId<%= attachment.id %>">
|
55
56
|
<dt>
|
56
57
|
<a href="<%= (attachment.isVideo?) ? attachment.getDownloadUrl + '?stream=1' : attachment.getShowUrl %>" type="<%= attachment.content_type %>" onclick="return false" id="slideshow.<%= @slideshowi %>.<%= slideshowj %>">
|
57
|
-
<img src="<%= attachment.getThumbUrl %>" srcset="<%= attachment.getSrcsetUrl %> 2x" width="200" height="150" alt="
|
58
|
+
<img src="<%= attachment.getThumbUrl %>" srcset="<%= attachment.getSrcsetUrl %> 2x" width="200" height="150" alt=""/>
|
58
59
|
<input type="hidden" value="<%= (setting_show_filename) ? attachment.filename : 'false' %>|<%= (setting_show_exifdate) ? format_time(attachment.created_on) : 'false' %>|<%= h(description) %>"/>
|
59
60
|
</a>
|
60
61
|
</dt>
|
@@ -66,6 +67,9 @@ end
|
|
66
67
|
<% if permission_edit %>
|
67
68
|
<button type="button" class="attachment edit" title="<%= l(:button_edit) %>" onclick="<%= raw attachment.getEditButton(form_authenticity_token) %>"></button>
|
68
69
|
<% end %>
|
70
|
+
<% if permission_rename %>
|
71
|
+
<button type="button" class="attachment rename" title="<%= l(:button_rename) %>" onclick="<%= raw attachment.getRenameButton(form_authenticity_token) %>"></button>
|
72
|
+
<% end %>
|
69
73
|
<% if permission_delete %>
|
70
74
|
<button type="button" class="attachment delete" title="<%= l(:button_delete) %>" onclick="<%= raw attachment.getDeleteButton(form_authenticity_token) %>"></button>
|
71
75
|
<% end %>
|
@@ -93,26 +97,31 @@ end
|
|
93
97
|
<% if !setting_show_album || (!attachment.isPhoto? && !attachment.isVideo?) || attachment.isExcluded? %>
|
94
98
|
<% description = (attachment.description.blank?) ? ' ' : attachment.description.gsub(/["\\\x0]/, ' ') %>
|
95
99
|
<li id="attachmentId<%= attachment.id %>">
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
<%
|
107
|
-
|
108
|
-
|
109
|
-
</a>
|
110
|
-
<% slideshowj += 1 %>
|
111
|
-
<% else %>
|
112
|
-
<button type="button" class="attachment show" title="<%= l(:button_show) %>" onclick="<%= raw attachment.getShowButton(setting_show_filename, setting_show_exifdate, description) %>"></button>
|
100
|
+
<span class="action">
|
101
|
+
<% if attachment.is_text? || attachment.isImage? || attachment.isVideo? %>
|
102
|
+
<% if attachment.isImage? || attachment.isVideo? %>
|
103
|
+
<a href="<%= attachment.getDownloadUrl.gsub('download', 'show') %>" type="<%= attachment.content_type %>" onclick="return false" id="slideshow.<%= @slideshowi %>.<%= slideshowj %>">
|
104
|
+
<input type="hidden" value="<%= (setting_show_filename) ? attachment.filename : 'false' %>|<%= (setting_show_exifdate) ? format_time(attachment.created_on) : 'false' %>|<%= h(description) %>" />
|
105
|
+
</a>
|
106
|
+
<% slideshowj += 1 %>
|
107
|
+
<% else %>
|
108
|
+
<button type="button" class="attachment show" title="<%= l(:button_show) %>" onclick="<%= raw attachment.getShowButton(setting_show_filename, setting_show_exifdate, description) %>"></button>
|
109
|
+
<% end %>
|
110
|
+
<% end %>
|
111
|
+
<% if attachment.readable? %>
|
112
|
+
<button type="button" class="attachment download" title="<%= l(:apijs_title_download, v: number_to_human_size(attachment.filesize)) %>" onclick="<%= raw attachment.getDownloadButton %>"></button>
|
113
113
|
<% end %>
|
114
|
-
|
115
|
-
|
114
|
+
<% if permission_edit %>
|
115
|
+
<button type="button" class="attachment edit" title="<%= l(:button_edit) %>" onclick="<%= raw attachment.getEditButton(form_authenticity_token) %>"></button>
|
116
|
+
<% end %>
|
117
|
+
<% if permission_rename %>
|
118
|
+
<button type="button" class="attachment rename" title="<%= l(:button_rename) %>" onclick="<%= raw attachment.getRenameButton(form_authenticity_token) %>"></button>
|
119
|
+
<% end %>
|
120
|
+
<% if permission_delete %>
|
121
|
+
<button type="button" class="attachment delete" title="<%= l(:button_delete) %>" onclick="<%= raw attachment.getDeleteButton(form_authenticity_token) %>"></button>
|
122
|
+
<% end %>
|
123
|
+
</span>
|
124
|
+
<strong class="filename"><%= attachment.filename %></strong>
|
116
125
|
<span class="description"><%= h(description) %></span>
|
117
126
|
<span class="size">(<%= number_to_human_size(attachment.filesize) %>)</span>
|
118
127
|
<span class="author"><%= h(attachment.author) %></span>
|
@@ -134,9 +143,7 @@ end
|
|
134
143
|
<%= link_to(image_tag('magnifier.png'), controller: 'attachments', action: 'show', id: attachment, filename: attachment.filename) %>
|
135
144
|
<% end %>
|
136
145
|
<%= link_to_attachment(attachment, class: 'icon icon-attachment', download: true) %>
|
137
|
-
|
138
|
-
<span class="description"><%= h(attachment.description) %></span>
|
139
|
-
<% end %>
|
146
|
+
<span class="description"><%= h(attachment.description) %></span>
|
140
147
|
<span class="size">(<%= number_to_human_size(attachment.filesize) %>)</span>
|
141
148
|
<span class="author"><%= h(attachment.author) %></span>
|
142
149
|
<span class="date">(<%= format_time(attachment.created_on) %>)</span>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
# Created J/12/12/2013
|
3
|
-
# Updated
|
3
|
+
# Updated J/20/08/2020
|
4
4
|
#
|
5
5
|
# Copyright 2008-2020 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
6
6
|
# https://www.luigifab.fr/redmine/apijs
|
@@ -120,7 +120,11 @@ end
|
|
120
120
|
<p>
|
121
121
|
<label><%= raw l(:label_role_and_permissions) %></label>
|
122
122
|
<a href="<%= url_for({controller: 'roles', action: 'permissions'}) %>"><%= raw l(:label_role_and_permissions) %></a>
|
123
|
-
<em class="info"
|
123
|
+
<em class="info">
|
124
|
+
<%= raw l(:permission_edit_attachments) %>
|
125
|
+
<br /><%= raw l(:permission_rename_attachments) %>
|
126
|
+
<br /><%= raw l(:permission_delete_attachments) %>
|
127
|
+
</em>
|
124
128
|
</p>
|
125
129
|
<p>
|
126
130
|
<label><%= raw l(:apijs_config_directories) %></label>
|
@@ -4,4 +4,4 @@
|
|
4
4
|
* This program is free software, you can redistribute it or modify
|
5
5
|
* it under the terms of the GNU General Public License (GPL).
|
6
6
|
*/
|
7
|
-
var apijsRedmine=new function(){"use strict";this.start=function(){var e=apijs.i18n.data;e.cs[252]="Chyba",e.de[250]="Eine Datei löschen",e.de[251]="Sind Sie sicher, dass Sie diese Datei löschen möchten?[br]Achtung, diese Aktion ist unrückgängig.",e.de[252]="Fehler",e.de[253]="Sie verfügen nicht über die notwendigen Rechte um diese Operation durchzuführen, bitte [a §]aktualisieren Sie die Seite[/a].",e.de[254]="Es tut uns leid, diese Datei existiert nicht mehr, bitte [a §]aktualisieren Sie die Seite[/a].",e.de[255]="Eine Beschreibung bearbeiten",e.de[256]="Bitte geben Sie weiter unten die neue Beschreibung für diese Datei an. Um die Beschreibung zu löschen lassen Sie das Feld leer.",e.en[250]="Remove
|
7
|
+
var apijsRedmine=new function(){"use strict";this.start=function(){var e=apijs.i18n.data;e.frca||(e.frca={}),e.cs[252]="Chyba",e.de[250]="Eine Datei löschen",e.de[251]="Sind Sie sicher, dass Sie diese Datei löschen möchten?[br]Achtung, diese Aktion ist unrückgängig.",e.de[252]="Fehler",e.de[253]="Sie verfügen nicht über die notwendigen Rechte um diese Operation durchzuführen, bitte [a §]aktualisieren Sie die Seite[/a].",e.de[254]="Es tut uns leid, diese Datei existiert nicht mehr, bitte [a §]aktualisieren Sie die Seite[/a].",e.de[255]="Eine Beschreibung bearbeiten",e.de[256]="Bitte geben Sie weiter unten die neue Beschreibung für diese Datei an. Um die Beschreibung zu löschen lassen Sie das Feld leer.",e.en[250]="Remove file",e.en[251]="Are you sure you want to remove this file?[br]Be careful, you can't cancel this operation.",e.en[252]="Error",e.en[253]="You are not authorized to perform this operation, please [a §]refresh the page[/a].",e.en[254]="Sorry, the file no longer exists, please [a §]refresh the page[/a].",e.en[255]="Edit description",e.en[256]="Enter below the new description for the file. To remove the description, leave the field empty.",e.en[257]="Rename file",e.en[258]="Enter below the new name for the file.",e.es[250]="Borrar un archivo",e.es[251]="¿Está usted seguro(a) de que desea eliminar este archivo?[br]Atención, pues no podrá cancelar esta operación.",e.es[253]="No está autorizado-a para llevar a cabo esta operación, por favor [a §]actualice la página[/a].",e.es[254]="Disculpe, pero el archivo ya no existe, por favor [a §]actualice la página[/a].",e.es[255]="Editar una descripción",e.es[256]="Introduzca a continuación la nueva descripción para el archivo. Para eliminar la descripción, deje el campo en blanco.",e.fr[250]="Supprimer le fichier",e.fr[251]="Êtes-vous sûr(e) de vouloir supprimer ce fichier ?[br]Attention, cette opération n'est pas annulable.",e.fr[252]="Erreur",e.fr[253]="Vous n'êtes pas autorisé(e) à effectuer cette opération, veuillez [a §]actualiser la page[/a].",e.fr[254]="Désolé, le fichier n'existe plus, veuillez [a §]actualiser la page[/a].",e.fr[255]="Modifier la description",e.fr[256]="Saisissez ci-dessous la nouvelle description pour ce fichier. Pour supprimer la description, laissez le champ vide.",e.fr[257]="Renommer le fichier",e.fr[258]="Saisissez ci-dessous le nouveau nom pour ce fichier.",e.it[250]="Eliminare un file",e.it[251]="Sicuri di voler eliminare il file?[br]Attenzione, questa operazione non può essere annullata.",e.it[252]="Errore",e.it[253]="Non siete autorizzati a eseguire questa operazione, vi preghiamo di [a §]ricaricare la pagina[/a].",e.it[254]="Spiacenti, il file non esiste più, vi preghiamo di [a §]ricaricare la pagina[/a].",e.it[255]="Modificare una descrizione",e.it[256]="Inserire qui sotto la nuova descrizione del file. Per cancellare la descrizione, lasciate lo spazio vuoto.",e.ja[250]="ファイルを削除",e.ja[252]="エラー",e.nl[252]="Fout",e.pl[252]="Błąd",e.pt[250]="Suprimir um ficheiro",e.pt[251]="Tem certeza de que quer suprimir este ficheiro?[br]Cuidado, não pode cancelar esta operação.",e.pt[252]="Erro",e.pt[253]="Não é autorizado(a) para efetuar esta operação, por favor [a §]atualize a página[/a].",e.pt[254]="Lamento, o ficheiro já não existe, por favor [a §]atualize a página[/a].",e.pt[255]="Modificar uma descrição",e.pt[256]="Digite abaixo a nova descrição para este ficheiro. Para suprimir a descrição, deixe o campo vazio.",e.ru[250]="Удалить файл",e.ru[251]="Вы уверены, что хотите удалить этот файл?[br]Осторожно, вы не сможете отменить эту операцию.",e.ru[252]="Ошибка",e.ru[253]="Вы не авторизованы для выполнения этой операции, пожалуйста [a §]обновите страницу[/a].",e.ru[254]="Извините, но файл не существует, пожалуйста [a §]обновите страницу[/a].",e.ru[255]="Редактировать описание",e.ru[256]="Ниже введите новое описание файла. Оставьте поле пустым, чтобы удалить описание.",e.sk[252]="Chyba",e.tr[252]="Hata",e.zh[252]="错误信息"},this.error=function(e){"string"==typeof e&&e.indexOf("<!DOCTYPE")<0?apijs.dialog.dialogInformation(apijs.i18n.translate(252),e,"error"):(apijs.dialog.remove("lock"),self.location.reload())},this.editAttachment=function(e,t,i,a){var r=apijs.i18n.translate(255),e=e.parentNode.parentNode.querySelector(".description").textContent.trim(),e='[p][label for="apijsinput"]'+apijs.i18n.translate(256)+'[/label][/p][input type="text" name="description" value="'+e+'" spellcheck="true" id="apijsinput"]';apijs.dialog.dialogFormOptions(r,e,i,apijsRedmine.actionEditAttachment,[t,i,a],"editattach"),apijs.dialog.t1.querySelector("input").select()},this.actionEditAttachment=function(e,t){if("boolean"==typeof e)return!0;var i;"string"==typeof e&&((i=new XMLHttpRequest).open("POST",t[1]+"?id="+t[0]+"&isAjax=true",!0),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-CSRF-Token",t[2]),i.onreadystatechange=function(){var e,t;4===i.readyState&&([0,200].has(i.status)?0===i.responseText.indexOf("attachmentId")?(t=i.responseText.slice(0,i.responseText.indexOf(":")),e=i.responseText.slice(i.responseText.indexOf(":")+1),(t=document.getElementById(t)).querySelector(".description").textContent=e,(t=t.querySelector("input"))&&(t.value=t.value.slice(0,t.value.lastIndexOf("|")+1)+e),apijs.dialog.actionClose()):apijsRedmine.error(i.responseText):apijsRedmine.error(i.status))},i.send("desc="+encodeURIComponent(document.getElementById("apijsinput").value)))},this.renameAttachment=function(e,t,i,a){var r=apijs.i18n.translate(257),e=e.parentNode.parentNode.querySelector(".filename").textContent.trim(),e='[p][label for="apijsinput"]'+apijs.i18n.translate(258)+'[/label][/p][input type="text" name="name" value="'+e+'" spellcheck="false" id="apijsinput"]';apijs.dialog.dialogFormOptions(r,e,i,apijsRedmine.actionRenameAttachment,[t,i,a],"editattach")},this.actionRenameAttachment=function(e,t){if("boolean"==typeof e)return!0;var r;"string"==typeof e&&((r=new XMLHttpRequest).open("POST",t[1]+"?id="+t[0]+"&isAjax=true",!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.setRequestHeader("X-CSRF-Token",t[2]),r.onreadystatechange=function(){var e,t,i,a;4===r.readyState&&([0,200].has(r.status)?0===r.responseText.indexOf("attachmentId")?(t=r.responseText.slice(0,r.responseText.indexOf(":")),i=r.responseText.slice(r.responseText.indexOf(":")+1),(a=document.getElementById(t)).querySelector(".filename").textContent=i,(t=a.querySelector("input"))&&(e=t.getAttribute("value"),t.setAttribute("value",i+e.substr(e.indexOf("|")))),(t=a.querySelector("a"))&&(e=t.getAttribute("href"),t.setAttribute("href",e.substr(0,e.lastIndexOf("/")+1)+i)),(t=a.querySelector("button.download"))&&(e=t.getAttribute("onclick"),t.setAttribute("onclick",e.substr(0,e.lastIndexOf("/")+1)+i+"';")),(t=a.querySelector("button.show"))&&(e=t.getAttribute("onclick"),t.setAttribute("onclick",e.substr(0,e.lastIndexOf("/")+1)+i+"';")),apijs.dialog.actionClose()):apijsRedmine.error(r.responseText):apijsRedmine.error(r.status))},r.send("name="+encodeURIComponent(document.getElementById("apijsinput").value)))},this.removeAttachment=function(e,t,i,a){apijs.dialog.dialogConfirmation(apijs.i18n.translate(250),apijs.i18n.translate(251),apijsRedmine.actionRemoveAttachment,[t,i,a])},this.actionRemoveAttachment=function(e){var a=new XMLHttpRequest;a.open("POST",e[1]+"?id="+e[0]+"&isAjax=true",!0),a.setRequestHeader("X-CSRF-Token",e[2]),a.onreadystatechange=function(){var e,t,i;4===a.readyState&&([0,200].has(a.status)?0===a.responseText.indexOf("attachmentId")?(t=(e=document.getElementById(a.responseText)).parentNode,i=0,t.removeChild(e),t.querySelectorAll("dl, li").length<1?t.parentNode.removeChild(t):t.querySelectorAll("a[id][type]").forEach(function(e){e.setAttribute("id",e.getAttribute("id").slice(0,e.getAttribute("id").lastIndexOf(".")+1)+i++)}),apijs.dialog.actionClose()):apijsRedmine.error(a.responseText):apijsRedmine.error(a.status))},a.send()}};"function"==typeof self.addEventListener&&self.addEventListener("apijsload",apijsRedmine.start.bind(apijsRedmine));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Copyright 2008-2020 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
3
|
-
* https://www.luigifab.fr/apijs - 6.
|
3
|
+
* https://www.luigifab.fr/apijs - 6.4.0
|
4
4
|
* This program is free software, you can redistribute it or modify
|
5
5
|
* it under the terms of the GNU General Public License (GPL).
|
6
6
|
*/
|
7
|
-
Array.prototype.has||(Array.prototype.has=function(t,e){if(t instanceof Array){for(e in t)if(t.hasOwnProperty(e)&&this.has(t[e]))return!0}else for(e in this)if(this.hasOwnProperty(e)&&this[e]===t)return!0;return!1}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(t,e,i){for(e=e||window,i=0;i<this.length;i++)t.call(e,this[i],i,this)});var apijs=new function(){"use strict";this.core={},this.version=630,this.config={lang:"auto",debug:!1,dialog:{closeOnClick:!1,restrictNavigation:!0,player:!0},slideshow:{ids:"slideshow",anchor:!0},upload:{tokenName:"X-CSRF-Token",tokenValue:null}},this.start=function(){var t;if(console.info("APIJS "+this.version.toString().split("").join(".")+" - hello - 1 MB/Mo = 1024 kB/ko"),document.getElementById("oldBrowser"))throw new Error("APIJS canceled, #oldBrowser detected!");(t=document.querySelector('link[href*="apijs/fontello.woff2"]'))&&t.getAttribute("href").indexOf("?a3ab5acff3")<0&&console.error("APIJS warning invalid cachekey for link:fontello.woff2?x, it must be ?a3ab5acff3"),(t=document.querySelector('script[src*="apijs.min.js?v="]'))&&t.getAttribute("src").indexOf("?v="+this.version)<0&&console.error("APIJS warning invalid cachekey for script:apijs.min.js?x, it must be ?v="+this.version),this.i18n=new this.core.i18n,this.player=null,this.dialog=new this.core.dialog,this.upload=new this.core.upload,this.slideshow=new this.core.slideshow,self.dispatchEvent(new CustomEvent("apijsbeforeload")),this.i18n.init(),this.slideshow.init(),self.addEventListener("popstate",apijs.slideshow.onPopState),self.addEventListener("hashchange",apijs.slideshow.onPopState),this.config.debug&&(console.info("APIJS available languages: "+Object.keys(this.i18n.data).join(" ")),console.info("APIJS language loaded: "+this.config.lang),console.info("APIJS successfully started")),self.dispatchEvent(new CustomEvent("apijsload"))},this.formatNumber=function(e,t){var i,s="number"==typeof t?t:!1===t?0:2;try{i=new Intl.NumberFormat(this.config.lang,{minimumFractionDigits:s,maximumFractionDigits:s}).format(e)}catch(t){i=e.toFixed(s)}return"number"==typeof t?i:i.replace(/[.,]00$/,"")},this.toArray=function(t){return Array.prototype.slice.call(t,0)},this.log=function(t){this.config.debug&&console.info("APIJS "+t)},this.openTab=function(t){t.preventDefault(),0<this.href.length&&self.open(this.href)},this.html=function(t){return 0===t.indexOf("#")||0===t.indexOf(this.config.slideshow.ids)?document.getElementById(t.replace("#","apijs")):this.dialog.t1?this.dialog.t1.querySelector(t):null},this.serialize=function(t,i){var s=[];return i="string"==typeof i?i:"",Array.prototype.forEach.call(t.elements,function(t){if(t.name&&!t.disabled&&!["file","reset","submit","button"].has(t.type)&&0===t.name.indexOf(i))if("select-multiple"===t.type)for(var e=0;e<t.options.length;e++)t.options[e].selected&&s.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.options[e].value));else["checkbox","radio"].has(t.type)&&!t.checked||s.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}),s.join("&")}};"function"==typeof self.addEventListener&&self.addEventListener("load",apijs.start.bind(apijs)),apijs.core.i18n=function(){"use strict";this.data={cs:{103:"Zrušit",104:"Potvrzení",105:"Zavřít",106:"Předchozí",107:"Další",142:"předchozí/další"},de:{103:"Abbrechen",104:"Bestätigen",105:"Schließen",106:"Zurück",107:"Weiter",108:"Datei wählen",109:"Dateien wählen",124:"Verarbeitung läuft...",141:"anfang/ende",142:"zurück/weiter",143:"wiedergabe/pause",144:"rückwärts/vorwärts",145:"leiser/lauter",146:"stumm",147:"vollbild",148:"beenden",149:"Ende",150:"Esc",161:"Alle Dateien wurden akzeptiert.",162:"Akzeptiertes Dateiformat: §.",163:"Akzeptiertes Dateiformate: § und §.",164:"Maximale Größe: § MB.",167:"Unerlaubtes Format",168:"Format zu gross",169:"Leere Datei",181:"§% - § kB/s - Noch § Minuten",182:"§% - § kB/s - Noch § Minute",183:"§% - § kB/s - Noch § Sekunden",185:"§% - bis § kB/s in § Minuten",186:"§% - bis § kB/s in § Minute",187:"§% - bis § kB/s in § Sekunden",188:"§% - bis § kB/s",191:"Abbrechen",192:"Sind Sie sicher? [span]Ja[/span] - Nein",193:"Es ist ein unerwarteter Fehler aufgetreten... Bitte versuchen Sie es noch einmal.",194:"Es ist ein Fehler beim Senden.",195:"Es ist ein Fehler bei der Verarbeitung.",196:"Wir laden Sie ein es erneut zu [a §]versuchen[/a]."},en:{102:"Ok",103:"Cancel",104:"Confirm",105:"Close",106:"Previous",107:"Next",108:"Choose a file",109:"Choose one or multiple files",124:"Operation in progress...",125:"Upload in progress...",126:"Processing file in progress...",131:"video",132:"video track",133:"audio track",134:"subtitles",135:"off",141:"start/end",142:"previous/next",143:"play/pause",144:"backward/forward",145:"decrease/increase the volume",146:"mute",147:"full screen",148:"quit",149:"End",150:"Escape",161:"All files are accepted.",162:"Accepted file format: §.",163:"Accepted file formats: § and §.",164:"Maximum size: § MB.",165:"Maximum size by file: § MB.|Total maximum size: § MB.",166:"§ MB",167:"Format not allowed",168:"Size too large",169:"File empty",181:"§% - § kB/s - § minutes left",182:"§% - § kB/s - § minute left",183:"§% - § kB/s - § seconds left",184:"§% - § kB/s",185:"§% - at § kB/s in § minutes",186:"§% - at § kB/s in § minute",187:"§% - at § kB/s in § seconds",188:"§% - at § kB/s",191:"Interrupt",192:"Are you sure? [span]Yes[/span] - No",193:"It seems that an unlikely mistake just happened... Please try again.",194:"An error occurred while sending.",195:"An error occurred while processing.",196:"We invite you to [a §]try again[/a]."},es:{102:"Aceptar",103:"Cancelar",104:"Confirmar",105:"Cerrar",106:"Anterior",107:"Siguiente",108:"Elegir un fichero",109:"Elegir uno o varios ficheros",124:"Operación en curso...",125:"Envío en progreso...",126:"Tratamiento en curso...",132:"pista video",133:"pista audio",134:"subtítulos",141:"inicio/fin",142:"anterior/siguiente",143:"reproducir/pausa",144:"retroceder/avanzar",145:"bajar/subir el volumen",146:"silenciar",147:"pantalla completa",148:"salir",149:"Fin",150:"Esc",161:"Se aceptan todos los archivos.",162:"Formato de archivo aceptado: §.",163:"Formatos de archivos aceptados: § y §.",164:"Tamaño máximo: § MB.",165:"Tamaño máximo por fichero: § Mo.|Tamaño máximo total: § Mo.",167:"Formato no autorizado",168:"Tamaño demasiado importante",169:"Fichero vacío",181:"§% - § kB/s - § minutos restantes",182:"§% - § kB/s - § minuto restantes",183:"§% - § kB/s - § segundos restantes",185:"§% - a § kB/s en § minutos",186:"§% - a § kB/s en § minuto",187:"§% - a § kB/s en § segundos",188:"§% - a § kB/s",191:"Interrumpir",192:"¿Está seguro(a)? [span]Sí[/span] - No",193:"Parece que un error improbable acabo de ocurrir... Por favor, inténtelo de nuevo.",194:"Se produjo un error durante el envío.",195:"Se produjo un error durante el procesamiento.",196:"Le invitamos a [a §]intentar de nuevo[/a]."},fr:{103:"Annuler",104:"Valider",105:"Fermer",106:"Précédent",107:"Suivant",108:"Choisir un fichier",109:"Choisir un ou plusieurs fichiers",124:"Opération en cours...",125:"Envoi en cours...",126:"Traitement en cours...",131:"vidéo",132:"piste vidéo",133:"piste audio",134:"sous-titres",141:"début/fin",142:"précédent/suivant",143:"lecture/pause",144:"reculer/avancer",145:"baisser/augmenter le volume",146:"couper le son",147:"plein écran",148:"quitter",149:"Fin",150:"Échap",161:"Tous les fichiers sont acceptés.",162:"Format de fichier accepté : §.",163:"Formats de fichier acceptés : § et §.",164:"Taille maximale : § Mo.",165:"Taille maximale par fichier : § Mo.|Taille maximale total : § Mo.",166:"§ Mo",167:"Format non autorisé",168:"Taille trop importante",169:"Fichier vide",181:"§% - § ko/s - § minutes restantes",182:"§% - § ko/s - § minute restante",183:"§% - § ko/s - § secondes restantes",184:"§% - § ko/s",185:"§% - à § ko/s en § minutes",186:"§% - à § ko/s en § minute",187:"§% - à § ko/s en § secondes",188:"§% - à § ko/s",191:"Interrompre",192:"Êtes-vous sûr(e) ? [span]Oui[/span] - Non",193:"Il semblerait qu'une erreur improbable vient de se produire... Veuillez réessayer.",194:"Une erreur est survenue lors de l'envoi.",195:"Une erreur est survenue lors du traitement.",196:"Nous vous invitons à [a §]réessayer[/a]."},it:{103:"Annulla",104:"Conferma",105:"Chiudi",106:"Precedente",107:"Successivo",108:"Scegli un file",109:"Scegli uno o più file",124:"Operazione in corso...",125:"Invio in corso...",126:"Trattamento in corso...",141:"inizio/fine",142:"precedente/successivo",143:"riproduci/pausa",144:"indietro/avanti",145:"abbassare/aumentare il volume",146:"muto",147:"schermo intero",148:"esci",149:"Fine",150:"Esc",161:"Tutti i file sono accettati.",162:"Formato del file accettato: §.",163:"Formati accettati: § et §.",164:"Dimensione massima: § MB.",167:"Formato non autorizzato",168:"Dimensione troppo importante",169:"File vuoto",181:"§% - § kB/s - § minuti rimanenti",182:"§% - § kB/s - § minuto rimanente",183:"§% - § kB/s - § secondi rimanenti",185:"§% - a § kB/s in § minuti",186:"§% - a § kB/s in § minuto",187:"§% - a § kB/s in § secondi",188:"§% - a § kB/s",191:"Interrompere",192:"Sei sicuro? [span]Si[/span] - No",193:"Sembra che un errore inaspettato si sia verificato... Riprova.",194:"Un errore si è verificato durante l'invio.",195:"Un errore si è verificato durante il trattamento.",196:"Vi invitiamo a [a §]riprovare[/a]."},ja:{103:"キャンセル",104:"承認",105:"閉じる",106:"前へ",107:"次へ",142:"前へ/次へ",166:"§ Mo",184:"§% - § Ko/s",192:"よろしいですか?[span]はい[/span] - いいえ"},nl:{103:"Annuleren",104:"Bevestigen",105:"Sluiten",106:"Vorige",107:"Volgende",142:"vorige/volgende"},pl:{103:"Anuluj",104:"Potwierdź",105:"Zamknij",106:"Poprzedni",107:"Następne",142:"poprzedni/następne"},pt:{103:"Cancelar",104:"Confirmar",105:"Fechar",106:"Anterior",107:"Seguinte",108:"Escolher um ficheiro",109:"Escolher um ou vários ficheiros",124:"Operação em processo...",125:"Envio em processo...",126:"Tratamento em processo...",131:"vídeo",141:"início/fim",142:"anterior/seguinte",143:"reprodução/pausa",144:"recuar/avançar",145:"subir/baixar o volume",146:"silenciar",147:"ecrã completo",148:"sair",149:"Fim",150:"Esc",161:"Todos os ficheiros foram aceites.",162:"Formato do ficheiro aceite: §.",163:"Formatos de ficheiro aceites: § e §.",164:"Tamanho máximo: § MB.",181:"§% - § kB/s - § minutos restantes",182:"§% - § kB/s - § minuto restantes",183:"§% - § kB/s - § segundos restantes",185:"§% - § kB/s em § minutos",186:"§% - § kB/s em § minuto",187:"§% - § kB/s em § segundos",188:"§% - § kB/s",192:"Tem a certeza? [span]Sim[/span] - Não",193:"Parece ter acontecido um erro imprevisto. Por favor, tente novamente.",194:"Ocorreu um erro ao enviar.",195:"Ocorreu um erro ao processar.",196:"Convidamo-lo a [a §]tentar novamente[/a]."},ptbr:{107:"Próximo",124:"Operação em andamento...",125:"Envio em andamento...",126:"Tratamento em andamento...",142:"anterior/próximo"},ru:{102:"Ок",103:"Отмена",104:"Подтвердить",105:"Закрыть",106:"Предыдущий",107:"Следующий",108:"Выберите файл",124:"Операция в процессе...",141:"начало/конец",142:"предыдущий/следующий",143:"воспроизведение/пауза",144:"назад/вперед",145:"понизить/повысить громкость",146:"отключить звук",147:"на весь экран",148:"выйти",161:"Все файлы приняты.",162:"Формат файла: §.",163:"Форматы файлов: § и §.",164:"Максимальный размер: § MB.",181:"§% - § kB/s - осталось § минут",182:"§% - § kB/s - осталось § минут",183:"§% - § kB/s - осталось § секунд",185:"§% - § kB/s за § минут",186:"§% - § kB/s за § минут",187:"§% - § kB/s за § секунд",188:"§% - § kB/s",192:"Вы уверены? [span]Да[/span] - нет",193:"Кажется произошла не предусмотренная ошибка... Попробуйте еще раз.",194:"Возникла ошибка при отправке файла.",195:"Возникла ошибка при обработке файла."},sk:{103:"Zrušiť",105:"Zavrieť",106:"Predchádzajúci",107:"Ďalší",142:"predchádzajúci/ďalší"},tr:{103:"İptal",104:"Onayla",105:"Kapat",106:"Önceki",107:"Sonraki",142:"önceki/sonraki",192:"Emin misiniz ? [span]Evet[/span] - Hayır"},zh:{103:"取消",104:"确认",105:"关闭",106:"前页",107:"下一步",142:"前页/下一步",192:"您确定吗?[span]是[/span] - 否"}},this.init=function(){var t,e=apijs.config.lang,i=document.querySelector("html");-1<e.indexOf("auto")&&(i.getAttribute("xml:lang")?t=i.getAttribute("xml:lang").slice(0,2):i.getAttribute("lang")&&(t=i.getAttribute("lang").slice(0,2)),"string"==typeof t&&this.data.hasOwnProperty(t)&&(apijs.config.lang=t)),this.data.hasOwnProperty(apijs.config.lang)||(apijs.config.lang="en")},this.translate=function(t){var e=apijs.config.lang,i=1,s="";if("string"!=typeof this.data[e][t])if(3<e.length&&"string"==typeof this.data[e.slice(0,2)][t])e=e.slice(0,2);else{if("en"===e||"string"!=typeof this.data.en[t])return t;e="en"}return 1<arguments.length?(this.data[e][t].split("§").forEach(function(t){s+=i<this.length?t+this[i++]:t},arguments),s):this.data[e][t]},this.translateNode=function(){return document.createTextNode(this.translate.apply(this,arguments))},this.changeLang=function(t){if("string"==typeof t){if(this.data.hasOwnProperty(t))return apijs.config.lang=t,!0;if(-1<t.indexOf("auto"))return apijs.config.lang=t,this.init(),!0}return!1}},apijs.core.select=function(){"use strict";this.init=function(){}},apijs.core.player=function(){"use strict";this.root=null,this.video=null,this.stalled=!1,this.subload=!1,this.init=function(t,e,i){var s,a;if(this.root=t,(this.video=e).removeAttribute("controls"),e.onloadedmetadata=function(t){if(this.stalled=!1,this.onTimeupdate(t),this.onProgress(t),"object"==typeof this.video.videoTracks){if(1<(a=this.video.videoTracks).length){for(s=0;s<a.length;s++)this.createOption("videotrack",s,""===a[s].label?a[s].language:a[s].language+" - "+a[s].label);this.updateSelect("videotrack",a.length,0)}this.html(".tracks.videotrack select").selectedIndex=0}if("object"==typeof this.video.audioTracks){if(1<(a=this.video.audioTracks).length){for(s=0;s<a.length;s++)this.createOption("audiotrack",s,""===a[s].label?a[s].language:a[s].language+" - "+a[s].label);this.updateSelect("audiotrack",a.length,0)}this.html(".tracks.audiotrack select").selectedIndex=0}}.bind(this),e.onstalled=function(t){this.stalled=!0,this.onWaiting(t)}.bind(this),e.onplaying=apijs.player.onPlay.bind(this),e.onpause=apijs.player.onPlay.bind(this),e.onended=apijs.player.onEnded.bind(this),e.onprogress=apijs.player.onProgress.bind(this),e.ontimeupdate=apijs.player.onTimeupdate.bind(this),e.onseeking=apijs.player.onTimeupdate.bind(this),e.onseeked=apijs.player.onWaiting.bind(this),e.onwaiting=apijs.player.onWaiting.bind(this),e.onloadstart=apijs.player.onWaiting.bind(this),e.oncanplay=apijs.player.onWaiting.bind(this),e.onvolumechange=apijs.player.actionVolume.bind(this),i.indexOf("m3u")<0)return this.createTags([i]);var n=new XMLHttpRequest;return n.open("GET",i,!0),n.onreadystatechange=function(){4===n.readyState&&(self.dispatchEvent(new CustomEvent("apijsajaxresponse",{detail:{from:"apijs.player.init",xhr:n}})),[0,200].has(n.status)?apijs.player.createTags(n.responseText.trim().split("\n")):apijs.dialog.onMediaLoad({type:"error"}))},n.send(),this},this.createTags=function(t){var e,i,s;if(!(0<this.video.childNodes.length)){for(this.vv=0,this.tt=0;"string"==typeof(e=t.shift());)0===e.indexOf("#APIJS#attr")?(i=e.split("|"),this.video.setAttribute(i[1],i[2])):0===e.indexOf("#APIJS#track|subtitles")?(i=e.split("|"),this.createOption("text",this.tt++,i[3]+" - "+i[2]),(s=document.createElement("track")).setAttribute("kind",i[1]),s.setAttribute("label",i[2]),s.setAttribute("srclang",i[3]),s.setAttribute("src",i[4]),s.onload=function(t){"showing"===t.target.track.mode&&(apijs.log("player:track:onload"),this.onWaiting(t),this.subload=!1)}.bind(this),s.onerror=function(t){"showing"===t.target.track.mode&&(apijs.log("player:track:onerror"),this.onWaiting(t),this.subload=!1)}.bind(this),this.video.appendChild(s)):0===e.indexOf("#EXTINF")?i=e.replace(/#EXTINF:[0-9]+,/,""):5<e.length&&"#"!==e[0]&&(this.createOption("video",this.vv++,"string"==typeof i?i:this.vv),(s=document.createElement("source")).setAttribute("src",e),s.onerror=apijs.dialog.onMediaLoad,this.video.appendChild(s));return this.updateSelect("video",this.vv,0),"object"==typeof this.video.textTracks&&this.updateSelect("text",this.tt,1,!0),this}},this.createOption=function(t,e,i){var s=document.createElement("option");s.setAttribute("value",e),s.appendChild(document.createTextNode(i)),this.html(".tracks."+t+" select").appendChild(s)},this.updateSelect=function(t,e,i,s){(!0===s?0:1)<e?(this.html(".tracks."+t).removeAttribute("style"),this.html(".tracks."+t+" em").textContent="("+e+")",this.html(".tracks."+t+" select").setAttribute("size",e<10?e+i:10)):(this.html(".tracks."+t).setAttribute("style","display:none;"),this.html(".tracks."+t+" select").innerHTML="")},this.html=function(t){return this.root.querySelector(t)},this.onTimeupdate=function(t){var e,i,s,a,n="00:00",o=this.video.currentTime;0<o&&(e=Math.floor(o/3600),i=Math.floor(o%3600/60),(s=Math.floor(o%60))<10&&(s="0"+s),i<10&&(i="0"+i),n=(e=0<e?e+":":"")+i+":"+s),(a=this.video.duration)===1/0||isNaN(a)||(e=Math.floor(a/3600),i=Math.floor(a%3600/60),(s=Math.floor(a%60))<10&&(s="0"+s),i<10&&(i="0"+i),n+=" / "+(e=0<e?e+":":"")+i+":"+s,this.html("svg.bar rect").style.width=o/a*100+"%"),this.html("span.time").textContent=n,this.stalled&&!this.subload&&(this.stalled=!1,this.onWaiting(t))},this.onProgress=function(){var t,e,i=this.html("svg.bar"),s=this.video,a=s.buffered.length;if(0<a&&s.duration!==1/0&&!isNaN(s.duration))for(i.querySelectorAll(".buffer").forEach(function(t){t.parentNode.removeChild(t)});0<a--;)(t=document.createElement("rect")).setAttribute("class","buffer"),99.8<(e=(s.buffered.end(a)-s.buffered.start(a))/s.duration*100)?t.setAttribute("style","left:0%; width:100%;"):t.setAttribute("style","left:"+s.buffered.start(a)/s.duration*100+"%; width:"+e+"%;"),i.appendChild(t)},this.onPlay=function(){this.video.paused?(this.html("span.play").textContent="",apijs.dialog.remove("playing")):(this.html("span.play").textContent="",apijs.dialog.add("playing"))},this.onEnded=function(){this.html("span.play").textContent="⟲"},this.onWaiting=function(t){apijs.log("player:onWaiting:"+t.type+" stalled:"+this.stalled+"/subload:"+this.subload),apijs.dialog[["loadstart","waiting","seeking","stalled"].has(t.type)?"add":"remove"]("loading")},this.actionVolume=function(t){var e=this.html("svg.vol"),i=e.offsetWidth,s=0,a=this.video;if(3!==a.networkState){if("object"==typeof t&&!isNaN(t.clientX)){for(;s+=e.offsetLeft,e=e.offsetParent;);s=(s=100*(t.clientX-s)/i/100)<=.1?0:.92<s?1:s,a.volume=s,a.muted=!1}this.html("svg.vol rect").style.width=a.muted?0:100*a.volume+"%"}},this.actionPosition=function(t){var e=this.html("svg.bar"),i=e.offsetWidth,s=0,a=this.video;if(3!==a.networkState&&"object"==typeof t&&a.duration!==1/0&&!isNaN(a.duration)){for(;s+=e.offsetLeft,e=e.offsetParent;);s=(s=a.duration*(t.clientX-s)*100/i/100)<=1?0:s,a.currentTime=s}},this.actionVideo=function(t){this.html("svg.bar rect").style.width="0",this.html("svg.bar").querySelectorAll(".buffer").forEach(function(t){t.parentNode.removeChild(t)}),this.html("span.play").textContent="",this.updateSelect("videotrack",0,0),this.updateSelect("audiotrack",0,0),this.video.src=this.video.querySelectorAll("source")[t.value].src,t.blur()},this.actionVideotrack=function(t){for(var e=this.video.videoTracks,i=0;i<e.length;i++)e[i].enabled=i==t.value;t.blur()},this.actionAudiotrack=function(t){for(var e=this.video.audioTracks,i=0;i<e.length;i++)e[i].enabled=i==t.value;t.blur()},this.actionText=function(t){for(var e=this.video.textTracks,i=0;i<e.length;i++)e[i].mode=i==t.value?"showing":"hidden";t.blur(),this.subload=!0}},apijs.core.dialog=function(){"use strict";this.klass=[],this.height=0,this.scroll=0,this.callback=null,this.args=null,this.xhr=null,this.ft=/information|confirmation|options|upload|progress|waiting|photo|video|iframe|ajax|start|ready|end|reduce|mobile|tiny|fullscreen/g,this.ti="a,area,button,input,textarea,select,object,iframe",this.ns="http://www.w3.org/2000/svg",this.media=null,this.t0=null,this.t1=null,this.t2=null,this.a=null,this.b=null,this.c=null,this.d=null,this.dialogInformation=function(t,e,i){return"string"==typeof t&&"string"==typeof e?this.init("information",i).htmlParent().htmlContent(t,e).htmlBtnOk().show("button.confirm"):(console.error("apijs.dialog.dialogInformation invalid arguments",apijs.toArray(arguments)),!1)},this.dialogConfirmation=function(t,e,i,s,a){return"string"==typeof t&&"string"==typeof e&&"function"==typeof i?(this.callback=i,this.args=s,this.init("confirmation",a).htmlParent().htmlContent(t,e).htmlBtnConfirm("button","apijs.dialog.actionConfirm();").show("button.confirm")):(console.error("apijs.dialog.dialogConfirmation invalid arguments",apijs.toArray(arguments)),!1)},this.dialogFormOptions=function(t,e,i,s,a,n){return"string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"function"==typeof s?(this.callback=s,this.args=a,this.init("options",n).htmlParent(i,"apijs.dialog.actionConfirm();").htmlContent(t,e).htmlBtnConfirm("submit").show(!0)):(console.error("apijs.dialog.dialogFormOptions invalid arguments",apijs.toArray(arguments)),!1)},this.dialogFormUpload=function(t,e,i,s,a,n){return"string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"string"==typeof s?this.init("upload",n).htmlParent(i,"apijs.upload.actionConfirm();").htmlContent(t,e).htmlUpload(s,"boolean"==typeof a&&a).htmlBtnConfirm("submit").show("button.browse"):(console.error("apijs.dialog.dialogFormUpload invalid arguments",apijs.toArray(arguments)),!1)},this.dialogProgress=function(t,e,i){return"string"==typeof t&&"string"==typeof e?this.init("progress",i).htmlParent().htmlContent(t,e).htmlSvgProgress().show():(console.error("apijs.dialog.dialogProgress invalid arguments",apijs.toArray(arguments)),!1)},this.dialogWaiting=function(t,e,i){return"string"==typeof t&&"string"==typeof e?this.init("waiting",i).htmlParent().htmlContent(t,e).htmlSvgLoader(!1).show():(console.error("apijs.dialog.dialogWaiting invalid arguments",apijs.toArray(arguments)),!1)},this.dialogPhoto=function(t,e,i,s,a){var n="string"==typeof a;return a=n?"notransition slideshow loading "+a:"notransition loading","string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"string"==typeof s?this.init("photo",a).htmlParent().htmlMedia(t,e,i,s).htmlHelp(n,!1).htmlBtnClose().htmlBtnNavigation().htmlSvgLoader().show():(console.error("apijs.dialog.dialogPhoto invalid arguments",apijs.toArray(arguments)),!1)},this.dialogVideo=function(t,e,i,s,a){var n="string"==typeof a;return a=n?"notransition slideshow loading "+a:"notransition loading","string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"string"==typeof s?this.init("video",a).htmlParent().htmlMedia(t,e,i,s).htmlHelp(n,t.indexOf("iframe")<0).htmlBtnClose().htmlBtnNavigation().htmlSvgLoader().show():(console.error("apijs.dialog.dialogVideo invalid arguments",apijs.toArray(arguments)),!1)},this.dialogIframe=function(t,e,i){return"string"==typeof t&&"boolean"==typeof e?this.init("iframe","string"==typeof i?i+" loading":"loading",!e).htmlParent().htmlIframe(t).htmlBtnClose(e).htmlSvgLoader(!1).show():(console.error("apijs.dialog.dialogIframe invalid arguments",apijs.toArray(arguments)),!1)},this.dialogAjax=function(t,e,i,s,a){if("string"!=typeof t||"boolean"!=typeof e||"function"!=typeof i)return console.error("apijs.dialog.dialogAjax invalid arguments",apijs.toArray(arguments)),!1;this.callback=i,this.args=s;var n=this.init("ajax","string"==typeof a?a+" loading":"loading",!e).htmlParent().htmlBtnClose(e).htmlSvgLoader(!1).show();return this.xhr=new XMLHttpRequest,this.xhr.open("GET",t,!0),this.xhr.onreadystatechange=function(){4===this.xhr.readyState&&"function"==typeof this.callback&&(this.callback(this.xhr,this.args),this.remove("loading"))}.bind(apijs.dialog),this.xhr.send(),n},this.update=function(){return this.has("start","ready","end")&&(apijs.dialog.t1&&apijs.dialog.t1.setAttribute("class",this.klass.join(" ")),apijs.dialog.t2&&apijs.dialog.t2.setAttribute("class",this.klass.join(" "))),this},this.add=function(){return Array.prototype.forEach.call(arguments,function(t){"string"!=typeof t&&console.error("apijs.dialog.add argument is not a string",t),this.klass.indexOf(t)<0&&this.klass.push(t)},this),this.update()},this.remove=function(){return Array.prototype.forEach.call(arguments,function(t){"string"!=typeof t&&console.error("apijs.dialog.remove argument is not a string",t),-1<this.klass.indexOf(t)&&this.klass.splice(this.klass.indexOf(t),1)},this),this.update()},this.toggle=function(t,e){return"string"==typeof t&&"string"==typeof e||console.error("apijs.dialog.toggle argument is not a string",t,e),this.has(t)&&this.remove(t),this.has(e)||this.add(e),this.update()},this.has=function(){return this.klass.has(apijs.toArray(arguments))},this.actionClose=function(t){new RegExp("#("+apijs.config.slideshow.ids+"[-\\.]\\d+[-\\.]\\d+)").test(self.location.href)&&apijs.config.slideshow.anchor&&"function"==typeof history.pushState&&history.pushState({},"",self.location.href.slice(0,self.location.href.indexOf("#"))),"object"==typeof t?"apijsDialog"!==t.target.getAttribute("id")||apijs.dialog.has("photo","video","progress","waiting","lock")||apijs.dialog.clear(!0):this.t1&&this.clear(!0)},this.onCloseBrowser=function(t){if(apijs.dialog.has("progress","waiting","lock"))return t.preventDefault(),t.stopPropagation(),t.m=apijs.i18n.translate(124),t.returnValue=t.m,t.m},this.onResizeBrowser=function(){var t=document.querySelector("body").clientWidth<=(apijs.dialog.has("photo","video")?900:460);apijs.dialog[t?"add":"remove"]("mobile"),t=document.querySelector("body").clientWidth<=300,apijs.dialog[t?"add":"remove"]("tiny")},this.onScrollBrowser=function(t){var e=t.target,i=!1;if(apijs.dialog.has("slideshow")&&!apijs.dialog.has("playing")&&!["OPTION","SELECT"].has(e.nodeName)&&["DOMMouseScroll","mousewheel","panleft","panright"].has(t.type))e=(new Date).getTime()/1e3,(apijs.dialog.scroll<1||e>1+apijs.dialog.scroll)&&(apijs.dialog.scroll=e,i=0<t.detail||t.wheelDelta<0,apijs.slideshow["panleft"===t.type||i?"actionNext":"actionPrev"]());else{if("OPTION"===e.nodeName)e=e.parentNode;else if(!["TEXTAREA","SELECT"].has(e.nodeName))for(;!0!==i&&"HTML"!==e.nodeName;)e.classList.contains("scrollable")?i=!0:e=e.parentNode;if("HTML"!==e.nodeName&&((i=0<t.detail||t.wheelDelta<0)&&e.scrollTop<e.scrollHeight-e.offsetHeight||!i&&0<e.scrollTop))return}apijs.dialog.stopScroll(t)},this.onScrollIframe=function(t){for(var e,i=t.target;i.parentNode;)i=i.parentNode;((e=0<t.detail||t.wheelDelta<0)&&i.defaultView.innerHeight+i.defaultView.pageYOffset>i.body.offsetHeight||!e&&i.defaultView.pageYOffset<=0)&&apijs.dialog.stopScroll(t)},this.onKey=function(t){var e=apijs.dialog,i=e.media,s=e.t1;isNaN(t)||(t={keyCode:t,ctrlKey:!1,altKey:!1,preventDefault:function(){}}),e.has("progress","waiting","lock")?(t.ctrlKey&&[81,87,82,115,116].has(t.keyCode)||t.altKey&&115===t.keyCode||[27,116].has(t.keyCode))&&t.preventDefault():e.has("photo","video")&&122===t.keyCode?(t.preventDefault(),document.webkitFullscreenElement?document.webkitCancelFullScreen():document.mozFullScreenElement?document.mozCancelFullScreen():document.fullscreenElement?document.cancelFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen&&s.mozRequestFullScreen()):e.has("slideshow")?27===t.keyCode?(t.preventDefault(),e.actionClose()):35===t.keyCode?(t.preventDefault(),apijs.slideshow.actionLast()):36===t.keyCode?(t.preventDefault(),apijs.slideshow.actionFirst()):37===t.keyCode?(t.preventDefault(),apijs.slideshow.actionPrev()):39===t.keyCode&&(t.preventDefault(),apijs.slideshow.actionNext()):27===t.keyCode&&(t.preventDefault(),e.actionClose()),e.has("video")&&(32===t.keyCode||80===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.ended||i.paused?i.play():i.pause())):38===t.keyCode||33===t.keyCode?(t.preventDefault(),3!==i.networkState&&i.duration!==1/0&&i.currentTime<i.duration-10&&(i.currentTime+=10)):40===t.keyCode||34===t.keyCode?(t.preventDefault(),3!==i.networkState&&i.duration!==1/0&&(10<i.currentTime?i.currentTime-=10:i.currentTime=0)):107===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.muted&&(i.muted=!1),i.volume<.8?i.volume+=.2:i.volume=1)):109===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.muted&&(i.muted=!1),.21<i.volume?i.volume-=.2:i.volume=0)):77===t.keyCode&&(t.preventDefault(),3!==i.networkState&&(i.muted=!i.muted))),[32,33,34,35,36,38,40].has(t.keyCode)&&(t.target&&["INPUT","TEXTAREA","OPTION","SELECT"].has(t.target.nodeName)||e.stopScroll(t))},this.stopScroll=function(t){t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation()},this.actionConfirm=function(){return this.has("options")&&!0!==this.callback(!1,this.args)||(this.add("lock","loading"),this.htmlSvgLoader(!1),apijs.html("div.btns").style.visibility="hidden",apijs.html("div.bbcode").style.visibility="hidden",self.setTimeout(function(){this.t2&&"FORM"===this.t2.nodeName?this.callback(this.t2.getAttribute("action"),this.args):this.t2&&this.callback(this.args)}.bind(this),12)),!1},this.onIframeLoad=function(t){t.removeAttribute("class"),apijs.dialog.remove("loading"),t.contentWindow.addEventListener("DOMMouseScroll",window.parent.apijs.dialog.onScrollIframe,{passive:!1}),t.contentWindow.addEventListener("mousewheel",window.parent.apijs.dialog.onScrollIframe,{passive:!1}),t.contentWindow.addEventListener("touchmove",window.parent.apijs.dialog.onScrollIframe,{passive:!1})},this.onMediaLoad=function(t){var e,i,s,a=apijs.dialog,n=a.media;t&&t.target&&(e=t.target.currentSrc||t.target.src,apijs.log("dialog:onMediaLoad:"+t.type+" "+(e?e.slice(e.lastIndexOf("/")+1):""))),n&&["load","durationchange"].has(t.type)?(a.remove("loading","error"),n.style.visibility="visible",n.hasAttribute("src")||"IMG"!==n.nodeName||n.setAttribute("src",n.imageLoader.src)):n&&"error"===t.type&&(a.toggle("loading","error"),n.removeAttribute("style"),(i=apijs.html(".tracks.video select"))&&t&&t.target&&0<(s=i.querySelectorAll("option")).length&&0<i.value.length&&(s[i.value].setAttribute("disabled","disabled"),i.selectedIndex+=1,"VIDEO"===t.target.nodeName&&""!==i.value&&apijs.player.actionVideo(i)))},this.onFullscreen=function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement;t&&apijs.log("dialog:onFullscreen:"+(e?"in":"out")),apijs.dialog[e?"add":"remove"]("fullscreen")},this.init=function(t,e,i){return"string"==typeof e?e=0<(e=e.replace(this.ft,"").trim()).length?!0===i?e+" lock":e:!0===i?"lock":null:!0===i&&(e="lock"),this.t0&&this.clear(!1),this.klass.push("start"),this.klass.push(t),self.matchMedia("prefers-reduced-motion:reduce").matches&&this.klass.push("reduce"),"string"==typeof e&&(this.klass=this.klass.concat(e.split(" "))),this.t0=document.createDocumentFragment(),document.addEventListener("keydown",apijs.dialog.onKey),self.addEventListener("beforeunload",apijs.dialog.onCloseBrowser),self.addEventListener("DOMMouseScroll",apijs.dialog.onScrollBrowser,{passive:!1}),self.addEventListener("mousewheel",apijs.dialog.onScrollBrowser,{passive:!1}),self.addEventListener("touchmove",apijs.dialog.onScrollBrowser,{passive:!1}),self.addEventListener("resize",apijs.dialog.onResizeBrowser),apijs.config.dialog.restrictNavigation&&document.querySelectorAll(this.ti).forEach(function(t){t.setAttribute("tabindex","-1")}),this},this.show=function(t){return this.onResizeBrowser(),this.onFullscreen(),0<this.height&&!this.has("photo","video")&&(this.t2.style.minHeight=this.height+"px"),apijs.html("#Dialog")?(this.toggle("start","ready"),this.t1=apijs.html("#Dialog"),this.t1.appendChild(this.t0.firstChild.firstChild),this.t1.setAttribute("class",this.t2.getAttribute("class"))):this.has("notransition")?(this.toggle("start","ready"),document.querySelector("body").appendChild(this.t0)):(document.querySelector("body").appendChild(this.t0),self.setTimeout(function(){apijs.dialog.toggle("start","ready")},12)),apijs.config.dialog.closeOnClick&&!this.has("progress","waiting","lock")&&document.addEventListener("click",apijs.dialog.actionClose),this.has("photo","video")&&(document.webkitFullscreenEnabled?document.addEventListener("webkitfullscreenchange",apijs.dialog.onFullscreen):document.fullscreenEnabled?document.addEventListener("fullscreenchange",apijs.dialog.onFullscreen):document.mozFullScreenEnabled&&document.addEventListener("mozfullscreenchange",apijs.dialog.onFullscreen)),!0===t?self.setTimeout(function(){apijs.html("input:not([readonly]),textarea:not([readonly]),select:not([disabled])").focus()},12):"string"==typeof t&&apijs.html(t).focus(),!0},this.clear=function(t){return t&&this.xhr&&(this.callback=null,this.xhr.abort()),document.removeEventListener("keydown",apijs.dialog.onKey),self.removeEventListener("beforeunload",apijs.dialog.onCloseBrowser),self.removeEventListener("DOMMouseScroll",apijs.dialog.onScrollBrowser,{passive:!1}),self.removeEventListener("mousewheel",apijs.dialog.onScrollBrowser,{passive:!1}),self.removeEventListener("touchmove",apijs.dialog.onScrollBrowser,{passive:!1}),self.removeEventListener("resize",apijs.dialog.onResizeBrowser),apijs.config.dialog.restrictNavigation&&document.querySelectorAll(this.ti).forEach(function(t){t.removeAttribute("tabindex")}),apijs.config.dialog.closeOnClick&&document.removeEventListener("click",apijs.dialog.actionClose),this.has("photo","video")&&(document.webkitFullscreenEnabled?document.removeEventListener("webkitfullscreenchange",apijs.dialog.onFullscreen):document.fullscreenEnabled?document.removeEventListener("fullscreenchange",apijs.dialog.onFullscreen):document.mozFullScreenEnabled&&document.removeEventListener("mozfullscreenchange",apijs.dialog.onFullscreen)),this.has("video")&&(this.media.ondurationchange=null,this.media.onerror=null),this.has("photo","video")||(this.height=parseFloat(self.getComputedStyle(this.t2).height)),t?(this.toggle("ready","end"),document.querySelector("body").removeChild(this.t1)):this.t1.removeChild(this.t2),this.klass=[],t&&(this.height=0,this.scroll=0,this.callback=null,this.args=null,this.xhr=null),this.media=null,this.t0=null,this.t1=null,this.t2=null,this.a=null,this.b=null,this.c=null,!(this.d=null)},this.htmlParent=function(t,e){return this.t1=document.createElement("div"),this.t1.setAttribute("id","apijsDialog"),"string"==typeof t?(this.t2=document.createElement("form"),this.t2.setAttribute("action",t),this.t2.setAttribute("method","post"),this.t2.setAttribute("enctype","multipart/form-data"),this.t2.setAttribute("onsubmit","return "+e)):this.t2=document.createElement("div"),this.t2.setAttribute("id","apijsBox"),this.t1.appendChild(this.t2),this.t0.appendChild(this.t1),this},this.htmlContent=function(t,e){return 0<t.length&&(this.a=document.createElement("h1"),this.a.innerHTML=t.replace(/</g,"<").replace(/>/g,">").replace(/\[/g,"<").replace(/]/g,">"),this.t2.appendChild(this.a)),0<e.length&&(this.a=document.createElement("div"),this.a.setAttribute("class","bbcode"),"["!==e[0]&&(e="[p]"+e+"[/p]"),this.a.innerHTML=e.replace(/</g,"<").replace(/>/g,">").replace(/\[/g,"<").replace(/]/g,">"),this.a.querySelectorAll("a.popup").forEach(function(t){t.addEventListener("click",apijs.openTab)}),this.t2.appendChild(this.a)),this},this.htmlBtnOk=function(){return this.a=document.createElement("div"),this.a.setAttribute("class","btns"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","confirm"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(102)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnConfirm=function(t,e){return this.a=document.createElement("div"),this.a.setAttribute("class","btns"),this.b=document.createElement("button"),this.b.setAttribute("type",t),this.b.setAttribute("class","confirm"),"submit"!==t&&this.b.setAttribute("onclick",e),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(104)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","cancel"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(103)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnNavigation=function(){return this.a=document.createElement("div"),this.a.setAttribute("class","navigation noplaying"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("disabled","disabled"),this.b.setAttribute("class","prev"),this.b.setAttribute("id","apijsPrev"),this.b.setAttribute("onclick","apijs.slideshow.actionPrev();"),this.c=document.createElement("span"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("disabled","disabled"),this.b.setAttribute("class","next"),this.b.setAttribute("id","apijsNext"),this.b.setAttribute("onclick","apijs.slideshow.actionNext();"),this.c=document.createElement("span"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnClose=function(t){return!1===t||(this.a=document.createElement("div"),this.a.setAttribute("class","close noplaying"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","close"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(105)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a)),this},this.htmlUpload=function(t,e){return this.a=document.createElement("div"),this.a.setAttribute("class","btns upload"),this.b=document.createElement("input"),this.b.setAttribute("type","file"),this.b.setAttribute("name",t),this.b.setAttribute("id","apijsFile"),e&&this.b.setAttribute("multiple","multiple"),this.b.setAttribute("onchange","apijs.upload.actionChoose(this);"),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","browse"),this.b.setAttribute("onclick","this.previousSibling.click();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(e?109:108)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("div"),this.b.setAttribute("class","filenames"),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgProgress=function(){return this.a=document.createElement("span"),this.a.setAttribute("class","info"),this.t2.appendChild(this.a),this.a=document.createElement("svg"),this.a.setAttribute("id","apijsProgress"),this.b=document.createElement("rect"),this.b.setAttribute("class","auto"),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgLoader=function(t){return this.a=document.createElementNS(this.ns,"svg"),this.a.setAttribute("class","loader"),this.b=document.createElementNS(this.ns,"path"),!1!==t&&this.b.setAttribute("style","opacity:0;"),this.b.setAttribute("d","M75.4 126.63a11.43 11.43 0 0 1-2.1-22.65 40.9 40.9 0 0 0 30.5-30.6 11.4 11.4 0 1 1 22.27 4.87h.02a63.77 63.77 0 0 1-47.8 48.05v-.02a11.38 11.38 0 0 1-2.93.37z"),this.c=document.createElementNS(this.ns,"animateTransform"),this.c.setAttribute("attributeName","transform"),this.c.setAttribute("type","rotate"),this.c.setAttribute("from","0 64 64"),this.c.setAttribute("to","360 64 64"),this.c.setAttribute("dur","5s"),this.c.setAttribute("repeatCount","indefinite"),this.b.appendChild(this.c),this.c=document.createElementNS(this.ns,"animate"),this.c.setAttribute("attributeName","opacity"),this.c.setAttribute("to","1"),this.c.setAttribute("dur","0.01s"),this.c.setAttribute("begin","1s"),this.c.setAttribute("fill","freeze"),!1!==t&&this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgPlayer=function(t){return this.a=document.createElement("span"),this.a.setAttribute("class","player noplaying"),this.b=document.createElement("span"),this.b.setAttribute("class","btn play fnt"),this.b.setAttribute("onclick","apijs.dialog.onKey(80);"),this.b.appendChild(document.createTextNode("")),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","svg bar"),this.c=document.createElement("svg"),this.c.setAttribute("class","bar"),this.c.setAttribute("onclick","apijs.player.actionPosition(event);"),this.d=document.createElement("rect"),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","time"),this.b.appendChild(document.createTextNode("00:00 / 00:00")),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","svg vol nomobile"),this.c=document.createElement("svg"),this.c.setAttribute("class","vol"),this.c.setAttribute("onclick","apijs.player.actionVolume(event);"),this.d=document.createElement("rect"),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks audiotrack"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(133)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionAudiotrack(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks videotrack"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(132)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionVideotrack(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks video"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(131)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionVideo(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks text"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(134)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionText(this);"),this.d=document.createElement("option"),this.d.appendChild(apijs.i18n.translateNode(135)),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","btn full fnt nomobile"),this.b.setAttribute("onclick","apijs.dialog.onKey(122);"),this.b.appendChild(document.createTextNode("")),this.a.appendChild(this.b),t.appendChild(this.a),this},this.htmlMedia=function(t,e,i,s){var a;return this.a=document.createElement("dl"),this.a.setAttribute("class","media"),this.b=document.createElement("dt"),this.has("photo")?(this.media=document.createElement("img"),this.media.setAttribute("alt",s.replace('"',""))):0<t.indexOf("iframe")?(this.media=document.createElement("iframe"),this.media.setAttribute("type","text/html"),this.media.setAttribute("scrolling","no"),this.media.setAttribute("src",t)):(this.media=document.createElement("video"),this.media.setAttribute("controls","controls"),this.media.setAttribute("preload","metadata"),this.media.setAttribute("onclick","apijs.dialog.onKey(80);")),this.media.setAttribute("id","apijsMedia"),this.b.appendChild(this.media),this.a.appendChild(this.b),this.b=document.createElement("dd"),this.b.setAttribute("class","nomobile noplaying"),"false"===e&&"false"===i||(a=t.slice(t.lastIndexOf("/")+1),this.c=document.createElement("span"),"false"!==e&&"auto"!==e&&"false"!==i?this.c.appendChild(document.createTextNode(e+" ("+i+") ")):"false"!==e&&"auto"!==e?this.c.appendChild(document.createTextNode(e+" ")):"auto"===e&&"false"!==i?this.c.appendChild(document.createTextNode(a+" ("+i+") ")):"auto"===e?this.c.appendChild(document.createTextNode(a+" ")):"false"!==i&&this.c.appendChild(document.createTextNode("("+i+") ")),this.b.appendChild(this.c)),this.b.appendChild(document.createTextNode(s)),this.a.appendChild(this.b),this.t2.appendChild(this.a),this.has("photo")?(this.media.imageLoader=new Image,this.media.imageLoader.src=t,this.media.imageLoader.onload=apijs.dialog.onMediaLoad,this.media.imageLoader.onerror=apijs.dialog.onMediaLoad):0<t.indexOf("iframe")?this.media.onload=apijs.dialog.onMediaLoad:!0===apijs.config.dialog.player?(this.media.setAttribute("class","player"),this.htmlSvgPlayer(this.media.parentNode),apijs.player=new apijs.core.player,apijs.player.init(this.media.parentNode,this.media,t),this.media.ondurationchange=apijs.dialog.onMediaLoad,this.media.onerror=apijs.dialog.onMediaLoad):"function"==typeof apijs.config.dialog.player?apijs.config.dialog.player(this.media,t):(this.c=document.createElement("source"),this.c.setAttribute("src",t),this.c.onerror=apijs.dialog.onMediaLoad,this.media.appendChild(this.c),this.media.ondurationchange=apijs.dialog.onMediaLoad,this.media.onerror=apijs.dialog.onMediaLoad),this},this.htmlHelp=function(t,e){var i,s,a=[t?["start",149,141]:[],t?["left","right",142]:[],e?["bottom","topk",144]:[],e?["minus","plus",145]:[],e?["M",146]:[],e?["P",143]:[],["F11",147],[150,148]];for(this.a=document.createElement("ul"),this.a.setAttribute("class","kbd nomobile nofullscreen");i=a.shift();)if(0<i.length){for(this.b=document.createElement("li");s=i.shift();)0<i.length?(this.c=document.createElement("kbd"),["M","P","F11"].has(s)?this.c.appendChild(document.createTextNode(s)):"string"==typeof s?this.c.setAttribute("class",s):this.c.appendChild(apijs.i18n.translateNode(s)),this.b.appendChild(this.c)):this.b.appendChild(apijs.i18n.translateNode(s));this.a.appendChild(this.b)}return this.t2.appendChild(this.a),this},this.htmlIframe=function(t){return this.a=document.createElement("iframe"),this.a.setAttribute("src",t),this.a.setAttribute("class","loading"),this.a.setAttribute("onload","apijs.dialog.onIframeLoad(this);"),this.t2.appendChild(this.a),this}},apijs.core.slideshow=function(){"use strict";this.current=null,this.init=function(){for(var t,e,i,s=apijs.config.slideshow.ids,a=0;e=apijs.html(s+"."+a);a++){for(i=e.classList.contains("hoverload"),t=0;e=apijs.html(s+"."+a+"."+t);t++)e.addEventListener("click",apijs.slideshow.show),i&&e.addEventListener("mouseover",apijs.slideshow.show);(e=apijs.html(s+"."+a+".99999"))&&e.addEventListener("click",apijs.slideshow.show)}this.onPopState()},this.onPopState=function(){var t;new RegExp("#("+apijs.config.slideshow.ids+"[-\\.]\\d+[-\\.]\\d+)").test(self.location.href)?(t=RegExp.$1.replace(/-/g,"."),apijs.html(t)&&!apijs.dialog.has("slideshow")&&apijs.slideshow.show(t,!1)):apijs.slideshow.current&&apijs.dialog.actionClose()},this.show=function(t,e){var i,s,a,n,o,r,l,h=!1,d={};if("string"==typeof t)h=!0,i=apijs.html(t),d.id=t;else{for(t.preventDefault(),i=t.target;"A"!==i.nodeName;)i=i.parentNode;if("mouseover"===t.type&&i.classList.contains("current"))return!1;d.id=i.getAttribute("id")}return d.prefix=apijs.config.slideshow.ids+"."+d.id.split(".")[1],d.number=parseInt(d.id.split(".")[2],10),d.gallery=apijs.html(d.prefix+".99999"),99999!==d.number&&(r=apijs.html(d.prefix).querySelectorAll("a[id][type]"),l=apijs.html(d.prefix).querySelectorAll("dl"),d.gallery||r.length!==l.length?(r.forEach(function(t){t.classList.remove("current")}),i.setAttribute("class","current")):(l.forEach(function(t){t.classList.remove("current")}),i.parentNode.parentNode.setAttribute("class","current"))),d.gallery?(99999===d.number&&(h=!0,i=d.gallery.hasAttribute("class")?d.gallery.getAttribute("class"):d.prefix+".0",i=apijs.html(i),d.number=parseInt(i.getAttribute("id").split(".")[2],10),d.id=d.id.replace(99999,d.number)),d.config=i.querySelector("input").getAttribute("value").split("|"),0<(s=d.config.shift()).indexOf(";")&&(a=(s=s.split(";"))[1].trim(),s=s[0].trim()),d.gallery.setAttribute("href",i.getAttribute("href")),d.gallery.querySelector("img").setAttribute("src",s),d.gallery.querySelector("img").setAttribute("srcset",a||""),d.gallery.querySelector("img").setAttribute("alt",i.querySelector("img").getAttribute("alt")),d.gallery.setAttribute("class",d.id)):(h=!0,d.config=i.querySelector("input").getAttribute("value").split("|")),d.url=i.getAttribute("href"),d.type=i.getAttribute("type").substr(0,5).replace("image","dialogPhoto").replace("video","dialogVideo"),d.type=0===d.type.indexOf("dialog")?d.type:"dialogPhoto",d.styles=apijs.html(d.prefix).getAttribute("class").replace(/gallery|album/g,"").trim(),h&&(apijs.dialog[d.type](d.url,d.config[0],d.config[1],d.config[2],d.styles),n=apijs.html(d.prefix).querySelectorAll("a[id][type]").length-(d.gallery?2:1),apijs.slideshow.current={number:d.number,first:d.prefix+".0",prev:0<d.number?d.prefix+"."+(d.number-1):null,next:d.number<n?d.prefix+"."+(d.number+1):null,last:d.prefix+"."+n,total:n},apijs.slideshow.current.prev&&apijs.html("#Prev").removeAttribute("disabled"),apijs.slideshow.current.next&&apijs.html("#Next").removeAttribute("disabled"),apijs.config.slideshow.anchor&&"function"==typeof history.pushState&&("boolean"!=typeof e||e)&&(o=0<(o=self.location.href).indexOf("#")?o.slice(0,o.indexOf("#")):o,o+="#"+(d.prefix+"."+(99999===d.number?0:d.number)).replace(/\./g,"-"),history.pushState({},"",o))),h},this.actionFirst=function(){return!!(this.current&&0<this.current.number&&this.current.number<=this.current.total)&&this.show(this.current.first)},this.actionPrev=function(){return!!(this.current&&this.current.prev&&0<this.current.number)&&this.show(this.current.prev)},this.actionNext=function(){return!!(this.current&&this.current.next&&this.current.number<this.current.total)&&this.show(this.current.next)},this.actionLast=function(){return!!(this.current&&0<=this.current.number&&this.current.number<this.current.total)&&this.show(this.current.last)}},apijs.core.upload=function(){"use strict";this.title=null,this.action=null,this.input=null,this.onemax=0,this.allmax=0,this.exts=null,this.callback=null,this.args=null,this.icon=null,this.files=[],this.start=0,this.end=0,this.sendFile=function(t,e,i,s,a,n,o,r){var l=this.sendFiles(t,e,i,s,0,a,n,o,r);return l||console.error("apijs.upload.sendFile invalid arguments",apijs.toArray(arguments)),l},this.sendFiles=function(t,e,i,s,a,n,o,r,l){if(this.files=[],!0!==t&&(this.title=t,this.action=e,this.input=i,this.onemax=s,this.allmax=a,this.exts="string"==typeof n?n.split(","):["*"],this.callback=o,this.args=r,this.icon=l),"string"!=typeof this.title||"string"!=typeof this.action||"string"!=typeof this.input||"number"!=typeof this.onemax||"number"!=typeof this.allmax||"function"!=typeof this.callback)return("number"!=typeof this.allmax||0<this.allmax)&&console.error("apijs.upload.sendFiles invalid arguments",apijs.toArray(arguments)),!1;var h=0<this.allmax,d="*"===this.exts.join()?apijs.i18n.translate(161):1===this.exts.length?apijs.i18n.translate(162,this.exts.join()):apijs.i18n.translate(163,this.exts.slice(0,-1).join(", "),this.exts.slice(-1));return d+="[br]"+apijs.i18n.translate(h?165:164,apijs.formatNumber(this.onemax),h?apijs.formatNumber(this.allmax):"").replace("|","[br]"),apijs.dialog.dialogFormUpload(this.title,d,this.action,this.input,h,this.icon)},this.actionChoose=function(t){var e,i=[],s=0;this.files=[],this.exts&&(Array.prototype.forEach.call(t.files,function(t){e=t.name+' <span class="sz">'+apijs.i18n.translate(166,apijs.formatNumber(t.size/1048576))+"</span>","*"===this.exts.join()||this.exts.has(t.name.slice(t.name.lastIndexOf(".")+1).toLowerCase())?t.size>1048576*this.onemax?e+=' <span class="ee">'+apijs.i18n.translate(168)+"</span>":t.size<=0?e+=' <span class="ee">'+apijs.i18n.translate(169)+"</span>":this.files.push(t):e+=' <span class="ee">'+apijs.i18n.translate(167)+"</span>",i.push("<div>"+e+"</div>"),s+=t.size/1048576},this),0<this.allmax&&s>=this.allmax&&i.push('<div class="tt"> = <span class="sz">'+apijs.i18n.translate(166,apijs.formatNumber(s))+'</span> <span class="ee">'+apijs.i18n.translate(168)+"</span></div>"),this.files.length===t.files.length?(apijs.html("button.confirm").removeAttribute("disabled"),apijs.html("button.confirm").focus()):apijs.html("button.confirm").setAttribute("disabled","disabled"),apijs.html("div.filenames").innerHTML=i.join(" "))},this.actionConfirm=function(){var s,e;return 0<this.files.length?(s=new FormData,(e=new XMLHttpRequest).open("POST",this.action+(0<this.action.indexOf("?")?"&isAjax=true":"?isAjax=true"),!0),"string"==typeof apijs.config.upload.tokenValue&&(e.setRequestHeader(apijs.config.upload.tokenName,apijs.config.upload.tokenValue),s.append(apijs.config.upload.tokenName,apijs.config.upload.tokenValue)),this.files.forEach(function(t,e,i){s.append(1<i.length&&this.input.indexOf("[")<0?this.input+"_"+e:this.input,t)},this),e.onreadystatechange=function(t){4===e.readyState&&(t=e.responseText.trim(),[0,200].has(e.status)?(self.dispatchEvent(new CustomEvent("apijsajaxresponse",{detail:{from:"apijs.upload.send",xhr:e}})),apijs.log("upload:onreadystatechange status:200 message:"+t),0===t.indexOf("success-")?(apijs.upload.updateTitle(),apijs.upload.callback(t.slice(8),apijs.upload.args)):apijs.upload.onError(195,t)):(apijs.log("upload:onreadystatechange status:"+e.status+" message: "+t),apijs.upload.onError(194,e.status)))},e.upload.onloadstart=apijs.upload.onStart.bind(this),e.upload.onprogress=apijs.upload.onProgress.bind(this),e.upload.onload=apijs.upload.onProgress.bind(this),e.upload.onerror=apijs.upload.onError.bind(this),e.send(s)):apijs.html("button.browse").focus(),!1},this.onStart=function(){this.start=this.end=Math.round((new Date).getTime()/1e3),apijs.dialog.dialogProgress(this.title,apijs.i18n.translate(125),this.icon)},this.onError=function(t,e){this.updateTitle(),"number"==typeof t?e="[p]"+apijs.i18n.translate(t)+"[/p] "+e:"string"!=typeof e&&(e="[p]"+apijs.i18n.translate(193)+"[/p]"),e+="[p]"+apijs.i18n.translate(196,'href="apijs://restart" onclick="apijs.upload.sendFile(true); return false;"')+"[/p]",apijs.dialog.dialogInformation(this.title,e,"string"==typeof this.icon?"upload error "+this.icon:"upload error")},this.onProgress=function(t){var e,i,s,a,n,o,r,l=Math.round((new Date).getTime()/1e3);t.lengthComputable&&"progress"===t.type&&l>=this.end+2?(this.end=l,0<(e=Math.floor(100*t.loaded/t.total))&&e<100&&(this.updateTitle(e),o=100*(n=l-this.start)/e+10,24<n&&(a=Math.round(o-n),a=10*Math.ceil(a/10),r=Math.ceil(a/60),s=Math.round(t.loaded/n/1024),n<40||o<90?(i=184,a=null):1<r?(i=181,a=r):50<a?(i=182,a=1):i=183),this.updateProgress(e,i,s,a))):"load"===t.type&&(a=Math.round((new Date).getTime()/1e3)-this.start,r=Math.ceil(a/60),0<(s=Math.round(t.loaded/a/1024))&&s!==1/0?1<r?(i=185,a=r):50<a?(i=186,a=1):20<a?i=187:(i=188,a=null):a=s=null,this.updateTitle(100),this.updateProgress(100,i,s,a))},this.updateProgress=function(t,e,i,s){var a,n=apijs.html("rect"),o=apijs.html("span.info");99<t?(a="100%",n.setAttribute("class","end"),n.style.width="",apijs.html("p").textContent=apijs.i18n.translate(126)):(n.style.width=a=t+"%",n.hasAttribute("class")&&n.removeAttribute("class")),"number"==typeof e&&"number"==typeof i&&"number"==typeof s?a=apijs.i18n.translate(e,t,apijs.formatNumber(i,!1),s):"number"==typeof e&&"number"==typeof i&&(a=apijs.i18n.translate(e,t,apijs.formatNumber(i,!1))),o.textContent=a},this.updateTitle=function(t){"number"==typeof t?document.title=/^\d{1,3}% - /.test(document.title)?t+"% - "+document.title.slice(document.title.indexOf(" - ")+3):t+"% - "+document.title:/^\d{1,3}% - /.test(document.title)&&(document.title=document.title.slice(document.title.indexOf(" - ")+3))}};
|
7
|
+
Array.prototype.has||(Array.prototype.has=function(t,e){if(t instanceof Array){for(e in t)if(t.hasOwnProperty(e)&&this.has(t[e]))return!0}else for(e in this)if(this.hasOwnProperty(e)&&this[e]===t)return!0;return!1}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(t,e,i){for(e=e||window,i=0;i<this.length;i++)t.call(e,this[i],i,this)});var apijs=new function(){"use strict";this.core={},this.version=640,this.config={lang:"auto",debug:!1,dialog:{closeOnClick:!1,restrictNavigation:!0,player:!0},slideshow:{ids:"slideshow",anchor:!0},upload:{tokenName:"X-CSRF-Token",tokenValue:null}},this.start=function(){var t;if(console.info("APIJS "+this.version.toString().split("").join(".")+" - hello - 1 MB/Mo = 1024 kB/ko"),document.getElementById("oldBrowser"))throw new Error("APIJS canceled, #oldBrowser detected!");(t=document.querySelector('link[href*="apijs/fontello.woff2"]'))&&t.getAttribute("href").indexOf("?a3ab5acff3")<0&&console.error("APIJS warning invalid cachekey for link:fontello.woff2?x, it must be ?a3ab5acff3"),(t=document.querySelector('script[src*="apijs.min.js?v="]'))&&t.getAttribute("src").indexOf("?v="+this.version)<0&&console.error("APIJS warning invalid cachekey for script:apijs.min.js?x, it must be ?v="+this.version),this.i18n=new this.core.i18n,this.player=null,this.dialog=new this.core.dialog,this.upload=new this.core.upload,this.slideshow=new this.core.slideshow,self.dispatchEvent(new CustomEvent("apijsbeforeload")),this.i18n.init(),this.slideshow.init(),self.addEventListener("popstate",apijs.slideshow.onPopState),self.addEventListener("hashchange",apijs.slideshow.onPopState),this.config.debug&&(console.info("APIJS available languages: "+Object.keys(this.i18n.data).join(" ")),console.info("APIJS language loaded: "+this.config.lang),console.info("APIJS successfully started")),self.dispatchEvent(new CustomEvent("apijsload"))},this.formatNumber=function(e,t){var i,s="number"==typeof t?t:!1===t?0:2;try{i=new Intl.NumberFormat(this.config.lang,{minimumFractionDigits:s,maximumFractionDigits:s}).format(e)}catch(t){i=e.toFixed(s)}return"number"==typeof t?i:i.replace(/[.,]00$/,"")},this.toArray=function(t){return Array.prototype.slice.call(t,0)},this.log=function(t){this.config.debug&&console.info("APIJS "+t)},this.openTab=function(t){t.preventDefault(),0<this.href.length&&self.open(this.href)},this.html=function(t){return 0===t.indexOf("#")||0===t.indexOf(this.config.slideshow.ids)?document.getElementById(t.replace("#","apijs")):this.dialog.t1?this.dialog.t1.querySelector(t):null},this.serialize=function(t,i){var s=[];return i="string"==typeof i?i:"",Array.prototype.forEach.call(t.elements,function(t){if(t.name&&!t.disabled&&!["file","reset","submit","button"].has(t.type)&&0===t.name.indexOf(i))if("select-multiple"===t.type)for(var e=0;e<t.options.length;e++)t.options[e].selected&&s.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.options[e].value));else["checkbox","radio"].has(t.type)&&!t.checked||s.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}),s.join("&")}};"function"==typeof self.addEventListener&&self.addEventListener("load",apijs.start.bind(apijs)),apijs.core.i18n=function(){"use strict";this.data={cs:{103:"Zrušit",104:"Potvrzení",105:"Zavřít",106:"Předchozí",107:"Další",142:"předchozí/další"},de:{103:"Abbrechen",104:"Bestätigen",105:"Schließen",106:"Zurück",107:"Weiter",108:"Datei wählen",109:"Dateien wählen",124:"Verarbeitung läuft...",141:"anfang/ende",142:"zurück/weiter",143:"wiedergabe/pause",144:"rückwärts/vorwärts",145:"leiser/lauter",146:"stumm",147:"vollbild",148:"beenden",149:"Ende",150:"Esc",161:"Alle Dateien wurden akzeptiert.",162:"Akzeptiertes Dateiformat: §.",163:"Akzeptiertes Dateiformate: § und §.",164:"Maximale Größe: § MB.",167:"Unerlaubtes Format",168:"Format zu gross",169:"Leere Datei",181:"§% - § kB/s - Noch § Minuten",182:"§% - § kB/s - Noch § Minute",183:"§% - § kB/s - Noch § Sekunden",185:"§% - bis § kB/s in § Minuten",186:"§% - bis § kB/s in § Minute",187:"§% - bis § kB/s in § Sekunden",188:"§% - bis § kB/s",191:"Abbrechen",192:"Sind Sie sicher? [span]Ja[/span] - Nein",193:"Es ist ein unerwarteter Fehler aufgetreten... Bitte versuchen Sie es noch einmal.",194:"Es ist ein Fehler beim Senden.",195:"Es ist ein Fehler bei der Verarbeitung.",196:"Wir laden Sie ein es erneut zu [a §]versuchen[/a]."},en:{102:"Ok",103:"Cancel",104:"Confirm",105:"Close",106:"Previous",107:"Next",108:"Choose a file",109:"Choose one or multiple files",124:"Operation in progress...",125:"Upload in progress...",126:"Processing file in progress...",131:"video",132:"video track",133:"audio track",134:"subtitles",135:"off",141:"start/end",142:"previous/next",143:"play/pause",144:"backward/forward",145:"decrease/increase the volume",146:"mute",147:"full screen",148:"quit",149:"End",150:"Escape",161:"All files are accepted.",162:"Accepted file format: §.",163:"Accepted file formats: § and §.",164:"Maximum size: § MB.",165:"Maximum size by file: § MB.|Total maximum size: § MB.",166:"§ MB",167:"Format not allowed",168:"Size too large",169:"File empty",181:"§% - § kB/s - § minutes left",182:"§% - § kB/s - § minute left",183:"§% - § kB/s - § seconds left",184:"§% - § kB/s",185:"§% - at § kB/s in § minutes",186:"§% - at § kB/s in § minute",187:"§% - at § kB/s in § seconds",188:"§% - at § kB/s",191:"Interrupt",192:"Are you sure? [span]Yes[/span] - No",193:"It seems that an unlikely mistake just happened... Please try again.",194:"An error occurred while sending.",195:"An error occurred while processing.",196:"We invite you to [a §]try again[/a]."},es:{102:"Aceptar",103:"Cancelar",104:"Confirmar",105:"Cerrar",106:"Anterior",107:"Siguiente",108:"Elegir un fichero",109:"Elegir uno o varios ficheros",124:"Operación en curso...",125:"Envío en progreso...",126:"Tratamiento en curso...",132:"pista video",133:"pista audio",134:"subtítulos",141:"inicio/fin",142:"anterior/siguiente",143:"reproducir/pausa",144:"retroceder/avanzar",145:"bajar/subir el volumen",146:"silenciar",147:"pantalla completa",148:"salir",149:"Fin",150:"Esc",161:"Se aceptan todos los archivos.",162:"Formato de archivo aceptado: §.",163:"Formatos de archivos aceptados: § y §.",164:"Tamaño máximo: § MB.",165:"Tamaño máximo por fichero: § Mo.|Tamaño máximo total: § Mo.",167:"Formato no autorizado",168:"Tamaño demasiado importante",169:"Fichero vacío",181:"§% - § kB/s - § minutos restantes",182:"§% - § kB/s - § minuto restantes",183:"§% - § kB/s - § segundos restantes",185:"§% - a § kB/s en § minutos",186:"§% - a § kB/s en § minuto",187:"§% - a § kB/s en § segundos",188:"§% - a § kB/s",191:"Interrumpir",192:"¿Está seguro(a)? [span]Sí[/span] - No",193:"Parece que un error improbable acabo de ocurrir... Por favor, inténtelo de nuevo.",194:"Se produjo un error durante el envío.",195:"Se produjo un error durante el procesamiento.",196:"Le invitamos a [a §]intentar de nuevo[/a]."},fr:{103:"Annuler",104:"Valider",105:"Fermer",106:"Précédent",107:"Suivant",108:"Choisir un fichier",109:"Choisir un ou plusieurs fichiers",124:"Opération en cours...",125:"Envoi en cours...",126:"Traitement en cours...",131:"vidéo",132:"piste vidéo",133:"piste audio",134:"sous-titres",141:"début/fin",142:"précédent/suivant",143:"lecture/pause",144:"reculer/avancer",145:"baisser/augmenter le volume",146:"couper le son",147:"plein écran",148:"quitter",149:"Fin",150:"Échap",161:"Tous les fichiers sont acceptés.",162:"Format de fichier accepté : §.",163:"Formats de fichier acceptés : § et §.",164:"Taille maximale : § Mo.",165:"Taille maximale par fichier : § Mo.|Taille maximale total : § Mo.",166:"§ Mo",167:"Format non autorisé",168:"Taille trop importante",169:"Fichier vide",181:"§% - § ko/s - § minutes restantes",182:"§% - § ko/s - § minute restante",183:"§% - § ko/s - § secondes restantes",184:"§% - § ko/s",185:"§% - à § ko/s en § minutes",186:"§% - à § ko/s en § minute",187:"§% - à § ko/s en § secondes",188:"§% - à § ko/s",191:"Interrompre",192:"Êtes-vous sûr(e) ? [span]Oui[/span] - Non",193:"Il semblerait qu'une erreur improbable vient de se produire... Veuillez réessayer.",194:"Une erreur est survenue lors de l'envoi.",195:"Une erreur est survenue lors du traitement.",196:"Nous vous invitons à [a §]réessayer[/a]."},it:{103:"Annulla",104:"Conferma",105:"Chiudi",106:"Precedente",107:"Successivo",108:"Scegli un file",109:"Scegli uno o più file",124:"Operazione in corso...",125:"Invio in corso...",126:"Trattamento in corso...",141:"inizio/fine",142:"precedente/successivo",143:"riproduci/pausa",144:"indietro/avanti",145:"abbassare/aumentare il volume",146:"muto",147:"schermo intero",148:"esci",149:"Fine",150:"Esc",161:"Tutti i file sono accettati.",162:"Formato del file accettato: §.",163:"Formati accettati: § et §.",164:"Dimensione massima: § MB.",167:"Formato non autorizzato",168:"Dimensione troppo importante",169:"File vuoto",181:"§% - § kB/s - § minuti rimanenti",182:"§% - § kB/s - § minuto rimanente",183:"§% - § kB/s - § secondi rimanenti",185:"§% - a § kB/s in § minuti",186:"§% - a § kB/s in § minuto",187:"§% - a § kB/s in § secondi",188:"§% - a § kB/s",191:"Interrompere",192:"Sei sicuro? [span]Si[/span] - No",193:"Sembra che un errore inaspettato si sia verificato... Riprova.",194:"Un errore si è verificato durante l'invio.",195:"Un errore si è verificato durante il trattamento.",196:"Vi invitiamo a [a §]riprovare[/a]."},ja:{103:"キャンセル",104:"承認",105:"閉じる",106:"前へ",107:"次へ",142:"前へ/次へ",166:"§ Mo",184:"§% - § Ko/s",192:"よろしいですか?[span]はい[/span] - いいえ"},nl:{103:"Annuleren",104:"Bevestigen",105:"Sluiten",106:"Vorige",107:"Volgende",142:"vorige/volgende"},pl:{103:"Anuluj",104:"Potwierdź",105:"Zamknij",106:"Poprzedni",107:"Następne",142:"poprzedni/następne"},pt:{103:"Cancelar",104:"Confirmar",105:"Fechar",106:"Anterior",107:"Seguinte",108:"Escolher um ficheiro",109:"Escolher um ou vários ficheiros",124:"Operação em processo...",125:"Envio em processo...",126:"Tratamento em processo...",131:"vídeo",141:"início/fim",142:"anterior/seguinte",143:"reprodução/pausa",144:"recuar/avançar",145:"subir/baixar o volume",146:"silenciar",147:"ecrã completo",148:"sair",149:"Fim",150:"Esc",161:"Todos os ficheiros foram aceites.",162:"Formato do ficheiro aceite: §.",163:"Formatos de ficheiro aceites: § e §.",164:"Tamanho máximo: § MB.",181:"§% - § kB/s - § minutos restantes",182:"§% - § kB/s - § minuto restantes",183:"§% - § kB/s - § segundos restantes",185:"§% - § kB/s em § minutos",186:"§% - § kB/s em § minuto",187:"§% - § kB/s em § segundos",188:"§% - § kB/s",192:"Tem a certeza? [span]Sim[/span] - Não",193:"Parece ter acontecido um erro imprevisto. Por favor, tente novamente.",194:"Ocorreu um erro ao enviar.",195:"Ocorreu um erro ao processar.",196:"Convidamo-lo a [a §]tentar novamente[/a]."},ptbr:{107:"Próximo",124:"Operação em andamento...",125:"Envio em andamento...",126:"Tratamento em andamento...",142:"anterior/próximo"},ru:{102:"Ок",103:"Отмена",104:"Подтвердить",105:"Закрыть",106:"Предыдущий",107:"Следующий",108:"Выберите файл",124:"Операция в процессе...",141:"начало/конец",142:"предыдущий/следующий",143:"воспроизведение/пауза",144:"назад/вперед",145:"понизить/повысить громкость",146:"отключить звук",147:"на весь экран",148:"выйти",161:"Все файлы приняты.",162:"Формат файла: §.",163:"Форматы файлов: § и §.",164:"Максимальный размер: § MB.",181:"§% - § kB/s - осталось § минут",182:"§% - § kB/s - осталось § минут",183:"§% - § kB/s - осталось § секунд",185:"§% - § kB/s за § минут",186:"§% - § kB/s за § минут",187:"§% - § kB/s за § секунд",188:"§% - § kB/s",192:"Вы уверены? [span]Да[/span] - нет",193:"Кажется произошла не предусмотренная ошибка... Попробуйте еще раз.",194:"Возникла ошибка при отправке файла.",195:"Возникла ошибка при обработке файла."},sk:{103:"Zrušiť",105:"Zavrieť",106:"Predchádzajúci",107:"Ďalší",142:"predchádzajúci/ďalší"},tr:{103:"İptal",104:"Onayla",105:"Kapat",106:"Önceki",107:"Sonraki",142:"önceki/sonraki",192:"Emin misiniz ? [span]Evet[/span] - Hayır"},zh:{103:"取消",104:"确认",105:"关闭",106:"前页",107:"下一步",142:"前页/下一步",192:"您确定吗?[span]是[/span] - 否"}},this.init=function(){var t,e=apijs.config.lang,i=document.querySelector("html");-1<e.indexOf("auto")&&(i.getAttribute("xml:lang")?t=i.getAttribute("xml:lang").slice(0,2):i.getAttribute("lang")&&(t=i.getAttribute("lang").slice(0,2)),"string"==typeof t&&this.data.hasOwnProperty(t)&&(apijs.config.lang=t)),this.data.hasOwnProperty(apijs.config.lang)||(apijs.config.lang="en")},this.translate=function(t){var e=apijs.config.lang,i=1,s="";if("string"!=typeof this.data[e][t])if(3<e.length&&"string"==typeof this.data[e.slice(0,2)][t])e=e.slice(0,2);else{if("en"===e||"string"!=typeof this.data.en[t])return t;e="en"}return 1<arguments.length?(this.data[e][t].split("§").forEach(function(t){s+=i<this.length?t+this[i++]:t},arguments),s):this.data[e][t]},this.translateNode=function(){return document.createTextNode(this.translate.apply(this,arguments))},this.changeLang=function(t){if("string"==typeof t){if(this.data.hasOwnProperty(t))return apijs.config.lang=t,!0;if(-1<t.indexOf("auto"))return apijs.config.lang=t,this.init(),!0}return!1}},apijs.core.select=function(){"use strict";this.init=function(){}},apijs.core.player=function(){"use strict";this.root=null,this.video=null,this.stalled=!1,this.subload=!1,this.init=function(t,e,i){var s,a;if(this.root=t,(this.video=e).removeAttribute("controls"),e.onloadedmetadata=function(t){if(this.stalled=!1,this.onTimeupdate(t),this.onProgress(t),"object"==typeof this.video.videoTracks){if(1<(a=this.video.videoTracks).length){for(s=0;s<a.length;s++)this.createOption("videotrack",s,""===a[s].label?a[s].language:a[s].language+" - "+a[s].label);this.updateSelect("videotrack",a.length,0)}this.html(".tracks.videotrack select").selectedIndex=0}if("object"==typeof this.video.audioTracks){if(1<(a=this.video.audioTracks).length){for(s=0;s<a.length;s++)this.createOption("audiotrack",s,""===a[s].label?a[s].language:a[s].language+" - "+a[s].label);this.updateSelect("audiotrack",a.length,0)}this.html(".tracks.audiotrack select").selectedIndex=0}}.bind(this),e.onstalled=function(t){this.stalled=!0,this.onWaiting(t)}.bind(this),e.onplaying=apijs.player.onPlay.bind(this),e.onpause=apijs.player.onPlay.bind(this),e.onended=apijs.player.onEnded.bind(this),e.onprogress=apijs.player.onProgress.bind(this),e.ontimeupdate=apijs.player.onTimeupdate.bind(this),e.onseeking=apijs.player.onTimeupdate.bind(this),e.onseeked=apijs.player.onWaiting.bind(this),e.onwaiting=apijs.player.onWaiting.bind(this),e.onloadstart=apijs.player.onWaiting.bind(this),e.oncanplay=apijs.player.onWaiting.bind(this),e.onvolumechange=apijs.player.actionVolume.bind(this),i.indexOf("m3u")<0)return this.createTags([i]);var n=new XMLHttpRequest;return n.open("GET",i,!0),n.onreadystatechange=function(){4===n.readyState&&(self.dispatchEvent(new CustomEvent("apijsajaxresponse",{detail:{from:"apijs.player.init",xhr:n}})),[0,200].has(n.status)?apijs.player.createTags(n.responseText.trim().split("\n")):apijs.dialog.onMediaLoad({type:"error"}))},n.send(),this},this.createTags=function(t){var e,i,s;if(!(0<this.video.childNodes.length)){for(this.vv=0,this.tt=0;"string"==typeof(e=t.shift());)0===e.indexOf("#APIJS#attr")?(i=e.split("|"),this.video.setAttribute(i[1],i[2])):0===e.indexOf("#APIJS#track|subtitles")?(i=e.split("|"),this.createOption("text",this.tt++,i[3]+" - "+i[2]),(s=document.createElement("track")).setAttribute("kind",i[1]),s.setAttribute("label",i[2]),s.setAttribute("srclang",i[3]),s.setAttribute("src",i[4]),s.onload=function(t){"showing"===t.target.track.mode&&(apijs.log("player:track:onload"),this.onWaiting(t),this.subload=!1)}.bind(this),s.onerror=function(t){"showing"===t.target.track.mode&&(apijs.log("player:track:onerror"),this.onWaiting(t),this.subload=!1)}.bind(this),this.video.appendChild(s)):0===e.indexOf("#EXTINF")?i=e.replace(/#EXTINF:[0-9]+,/,""):5<e.length&&"#"!==e[0]&&(this.createOption("video",this.vv++,"string"==typeof i?i:this.vv),(s=document.createElement("source")).setAttribute("src",e),s.onerror=apijs.dialog.onMediaLoad,this.video.appendChild(s));return this.updateSelect("video",this.vv,0),"object"==typeof this.video.textTracks&&this.updateSelect("text",this.tt,1,!0),this}},this.createOption=function(t,e,i){var s=document.createElement("option");s.setAttribute("value",e),s.appendChild(document.createTextNode(i)),this.html(".tracks."+t+" select").appendChild(s)},this.updateSelect=function(t,e,i,s){(!0===s?0:1)<e?(this.html(".tracks."+t).removeAttribute("style"),this.html(".tracks."+t+" em").textContent="("+e+")",this.html(".tracks."+t+" select").setAttribute("size",e<10?e+i:10)):(this.html(".tracks."+t).setAttribute("style","display:none;"),this.html(".tracks."+t+" select").innerHTML="")},this.html=function(t){return this.root.querySelector(t)},this.onTimeupdate=function(t){var e,i,s,a,n="00:00",o=this.video.currentTime;0<o&&(e=Math.floor(o/3600),i=Math.floor(o%3600/60),(s=Math.floor(o%60))<10&&(s="0"+s),i<10&&(i="0"+i),n=(e=0<e?e+":":"")+i+":"+s),(a=this.video.duration)===1/0||isNaN(a)||(e=Math.floor(a/3600),i=Math.floor(a%3600/60),(s=Math.floor(a%60))<10&&(s="0"+s),i<10&&(i="0"+i),n+=" / "+(e=0<e?e+":":"")+i+":"+s,this.html("svg.bar rect").style.width=o/a*100+"%"),this.html("span.time").textContent=n,this.stalled&&!this.subload&&(this.stalled=!1,this.onWaiting(t))},this.onProgress=function(){var t,e,i=this.html("svg.bar"),s=this.video,a=s.buffered.length;if(0<a&&s.duration!==1/0&&!isNaN(s.duration))for(i.querySelectorAll(".buffer").forEach(function(t){t.parentNode.removeChild(t)});0<a--;)(t=document.createElement("rect")).setAttribute("class","buffer"),99.8<(e=(s.buffered.end(a)-s.buffered.start(a))/s.duration*100)?t.setAttribute("style","left:0%; width:100%;"):t.setAttribute("style","left:"+s.buffered.start(a)/s.duration*100+"%; width:"+e+"%;"),i.appendChild(t)},this.onPlay=function(){this.video.paused?(this.html("span.play").textContent="",apijs.dialog.remove("playing")):(this.html("span.play").textContent="",apijs.dialog.add("playing"))},this.onEnded=function(){this.html("span.play").textContent="⟲"},this.onWaiting=function(t){apijs.log("player:onWaiting:"+t.type+" stalled:"+this.stalled+"/subload:"+this.subload),apijs.dialog[["loadstart","waiting","seeking","stalled"].has(t.type)?"add":"remove"]("loading")},this.actionVolume=function(t){var e=this.html("svg.vol"),i=e.offsetWidth,s=0,a=this.video;if(3!==a.networkState){if("object"==typeof t&&!isNaN(t.clientX)){for(;s+=e.offsetLeft,e=e.offsetParent;);s=(s=100*(t.clientX-s)/i/100)<=.1?0:.92<s?1:s,a.volume=s,a.muted=!1}this.html("svg.vol rect").style.width=a.muted?0:100*a.volume+"%"}},this.actionPosition=function(t){var e=this.html("svg.bar"),i=e.offsetWidth,s=0,a=this.video;if(3!==a.networkState&&"object"==typeof t&&a.duration!==1/0&&!isNaN(a.duration)){for(;s+=e.offsetLeft,e=e.offsetParent;);s=(s=a.duration*(t.clientX-s)*100/i/100)<=1?0:s,a.currentTime=s}},this.actionVideo=function(t){this.html("svg.bar rect").style.width="0",this.html("svg.bar").querySelectorAll(".buffer").forEach(function(t){t.parentNode.removeChild(t)}),this.html("span.play").textContent="",this.updateSelect("videotrack",0,0),this.updateSelect("audiotrack",0,0),this.video.src=this.video.querySelectorAll("source")[t.value].src,t.blur()},this.actionVideotrack=function(t){for(var e=this.video.videoTracks,i=0;i<e.length;i++)e[i].enabled=i==t.value;t.blur()},this.actionAudiotrack=function(t){for(var e=this.video.audioTracks,i=0;i<e.length;i++)e[i].enabled=i==t.value;t.blur()},this.actionText=function(t){for(var e=this.video.textTracks,i=0;i<e.length;i++)e[i].mode=i==t.value?"showing":"hidden";t.blur(),this.subload=!0}},apijs.core.dialog=function(){"use strict";this.klass=[],this.height=0,this.scroll=0,this.callback=null,this.args=null,this.xhr=null,this.ft=/information|confirmation|options|upload|progress|waiting|photo|video|iframe|ajax|start|ready|end|reduce|mobile|tiny|fullscreen/g,this.ti="a,area,button,input,textarea,select,object,iframe",this.ns="http://www.w3.org/2000/svg",this.media=null,this.t0=null,this.t1=null,this.t2=null,this.a=null,this.b=null,this.c=null,this.d=null,this.dialogInformation=function(t,e,i){return"string"==typeof t&&"string"==typeof e?this.init("information",i).htmlParent().htmlContent(t,e).htmlBtnOk().show("button.confirm"):(console.error("apijs.dialog.dialogInformation invalid arguments",apijs.toArray(arguments)),!1)},this.dialogConfirmation=function(t,e,i,s,a){return"string"==typeof t&&"string"==typeof e&&"function"==typeof i?(this.callback=i,this.args=s,this.init("confirmation",a).htmlParent().htmlContent(t,e).htmlBtnConfirm("button","apijs.dialog.actionConfirm();").show("button.confirm")):(console.error("apijs.dialog.dialogConfirmation invalid arguments",apijs.toArray(arguments)),!1)},this.dialogFormOptions=function(t,e,i,s,a,n){return"string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"function"==typeof s?(this.callback=s,this.args=a,this.init("options",n).htmlParent(i,"apijs.dialog.actionConfirm();").htmlContent(t,e).htmlBtnConfirm("submit").show(!0)):(console.error("apijs.dialog.dialogFormOptions invalid arguments",apijs.toArray(arguments)),!1)},this.dialogFormUpload=function(t,e,i,s,a,n){return"string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"string"==typeof s?this.init("upload",n).htmlParent(i,"apijs.upload.actionConfirm();").htmlContent(t,e).htmlUpload(s,"boolean"==typeof a&&a).htmlBtnConfirm("submit").show("button.browse"):(console.error("apijs.dialog.dialogFormUpload invalid arguments",apijs.toArray(arguments)),!1)},this.dialogProgress=function(t,e,i){return"string"==typeof t&&"string"==typeof e?this.init("progress",i).htmlParent().htmlContent(t,e).htmlSvgProgress().show():(console.error("apijs.dialog.dialogProgress invalid arguments",apijs.toArray(arguments)),!1)},this.dialogWaiting=function(t,e,i){return"string"==typeof t&&"string"==typeof e?this.init("waiting",i).htmlParent().htmlContent(t,e).htmlSvgLoader(!1).show():(console.error("apijs.dialog.dialogWaiting invalid arguments",apijs.toArray(arguments)),!1)},this.dialogPhoto=function(t,e,i,s,a){var n="string"==typeof a;return a=n?"notransition slideshow loading "+a:"notransition loading","string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"string"==typeof s?this.init("photo",a).htmlParent().htmlMedia(t,e,i,s).htmlHelp(n,!1).htmlBtnClose().htmlBtnNavigation().htmlSvgLoader().show():(console.error("apijs.dialog.dialogPhoto invalid arguments",apijs.toArray(arguments)),!1)},this.dialogVideo=function(t,e,i,s,a){var n="string"==typeof a;return a=n?"notransition slideshow loading "+a:"notransition loading","string"==typeof t&&"string"==typeof e&&"string"==typeof i&&"string"==typeof s?this.init("video",a).htmlParent().htmlMedia(t,e,i,s).htmlHelp(n,t.indexOf("iframe")<0).htmlBtnClose().htmlBtnNavigation().htmlSvgLoader().show():(console.error("apijs.dialog.dialogVideo invalid arguments",apijs.toArray(arguments)),!1)},this.dialogIframe=function(t,e,i){return"string"==typeof t&&"boolean"==typeof e?this.init("iframe","string"==typeof i?i+" loading":"loading",!e).htmlParent().htmlIframe(t).htmlBtnClose(e).htmlSvgLoader(!1).show():(console.error("apijs.dialog.dialogIframe invalid arguments",apijs.toArray(arguments)),!1)},this.dialogAjax=function(t,e,i,s,a){if("string"!=typeof t||"boolean"!=typeof e||"function"!=typeof i)return console.error("apijs.dialog.dialogAjax invalid arguments",apijs.toArray(arguments)),!1;this.callback=i,this.args=s;e=this.init("ajax","string"==typeof a?a+" loading":"loading",!e).htmlParent().htmlBtnClose(e).htmlSvgLoader(!1).show();return this.xhr=new XMLHttpRequest,this.xhr.open("GET",t,!0),this.xhr.onreadystatechange=function(){4===this.xhr.readyState&&"function"==typeof this.callback&&(this.callback(this.xhr,this.args),this.remove("loading"))}.bind(apijs.dialog),this.xhr.send(),e},this.update=function(){return this.has("start","ready","end")&&(apijs.dialog.t1&&apijs.dialog.t1.setAttribute("class",this.klass.join(" ")),apijs.dialog.t2&&apijs.dialog.t2.setAttribute("class",this.klass.join(" "))),this},this.add=function(){return Array.prototype.forEach.call(arguments,function(t){"string"!=typeof t&&console.error("apijs.dialog.add argument is not a string",t),this.klass.indexOf(t)<0&&this.klass.push(t)},this),this.update()},this.remove=function(){return Array.prototype.forEach.call(arguments,function(t){"string"!=typeof t&&console.error("apijs.dialog.remove argument is not a string",t),-1<this.klass.indexOf(t)&&this.klass.splice(this.klass.indexOf(t),1)},this),this.update()},this.toggle=function(t,e){return"string"==typeof t&&"string"==typeof e||console.error("apijs.dialog.toggle argument is not a string",t,e),this.has(t)&&this.remove(t),this.has(e)||this.add(e),this.update()},this.has=function(){return this.klass.has(apijs.toArray(arguments))},this.actionClose=function(t){new RegExp("#("+apijs.config.slideshow.ids+"[-\\.]\\d+[-\\.]\\d+)").test(self.location.href)&&apijs.config.slideshow.anchor&&"function"==typeof history.pushState&&history.pushState({},"",self.location.href.slice(0,self.location.href.indexOf("#"))),"object"==typeof t?"apijsDialog"!==t.target.getAttribute("id")||apijs.dialog.has("photo","video","progress","waiting","lock")||apijs.dialog.clear(!0):this.t1&&this.clear(!0)},this.onCloseBrowser=function(t){if(apijs.dialog.has("progress","waiting","lock"))return t.preventDefault(),t.stopPropagation(),t.m=apijs.i18n.translate(124),t.returnValue=t.m,t.m},this.onResizeBrowser=function(){var t=document.querySelector("body").clientWidth<=(apijs.dialog.has("photo","video")?900:460);apijs.dialog[t?"add":"remove"]("mobile"),t=document.querySelector("body").clientWidth<=300,apijs.dialog[t?"add":"remove"]("tiny")},this.onScrollBrowser=function(t){var e=t.target,i=!1;if(apijs.dialog.has("slideshow")&&!apijs.dialog.has("playing")&&!["OPTION","SELECT"].has(e.nodeName)&&["DOMMouseScroll","mousewheel","panleft","panright"].has(t.type))e=(new Date).getTime()/1e3,(apijs.dialog.scroll<1||e>1+apijs.dialog.scroll)&&(apijs.dialog.scroll=e,i=0<t.detail||t.wheelDelta<0,apijs.slideshow["panleft"===t.type||i?"actionNext":"actionPrev"]());else{if("OPTION"===e.nodeName)e=e.parentNode;else if(!["TEXTAREA","SELECT"].has(e.nodeName))for(;!0!==i&&"HTML"!==e.nodeName;)e.classList.contains("scrollable")?i=!0:e=e.parentNode;if("HTML"!==e.nodeName&&((i=0<t.detail||t.wheelDelta<0)&&e.scrollTop<e.scrollHeight-e.offsetHeight||!i&&0<e.scrollTop))return}apijs.dialog.stopScroll(t)},this.onScrollIframe=function(t){for(var e,i=t.target;i.parentNode;)i=i.parentNode;((e=0<t.detail||t.wheelDelta<0)&&i.defaultView.innerHeight+i.defaultView.pageYOffset>i.body.offsetHeight||!e&&i.defaultView.pageYOffset<=0)&&apijs.dialog.stopScroll(t)},this.onKey=function(t){var e=apijs.dialog,i=e.media,s=e.t1;isNaN(t)||(t={keyCode:t,ctrlKey:!1,altKey:!1,preventDefault:function(){}}),e.has("progress","waiting","lock")?(t.ctrlKey&&[81,87,82,115,116].has(t.keyCode)||t.altKey&&115===t.keyCode||[27,116].has(t.keyCode))&&t.preventDefault():e.has("photo","video")&&122===t.keyCode?(t.preventDefault(),document.webkitFullscreenElement?document.webkitCancelFullScreen():document.mozFullScreenElement?document.mozCancelFullScreen():document.fullscreenElement?document.cancelFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen&&s.mozRequestFullScreen()):e.has("slideshow")?27===t.keyCode?(t.preventDefault(),e.actionClose()):35===t.keyCode?(t.preventDefault(),apijs.slideshow.actionLast()):36===t.keyCode?(t.preventDefault(),apijs.slideshow.actionFirst()):37===t.keyCode?(t.preventDefault(),apijs.slideshow.actionPrev()):39===t.keyCode&&(t.preventDefault(),apijs.slideshow.actionNext()):27===t.keyCode&&(t.preventDefault(),e.actionClose()),e.has("video")&&(32===t.keyCode||80===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.ended||i.paused?i.play():i.pause())):38===t.keyCode||33===t.keyCode?(t.preventDefault(),3!==i.networkState&&i.duration!==1/0&&i.currentTime<i.duration-10&&(i.currentTime+=10)):40===t.keyCode||34===t.keyCode?(t.preventDefault(),3!==i.networkState&&i.duration!==1/0&&(10<i.currentTime?i.currentTime-=10:i.currentTime=0)):107===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.muted&&(i.muted=!1),i.volume<.8?i.volume+=.2:i.volume=1)):109===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.muted&&(i.muted=!1),.21<i.volume?i.volume-=.2:i.volume=0)):77===t.keyCode&&(t.preventDefault(),3!==i.networkState&&(i.muted=!i.muted))),[32,33,34,35,36,38,40].has(t.keyCode)&&(t.target&&["INPUT","TEXTAREA","OPTION","SELECT"].has(t.target.nodeName)||e.stopScroll(t))},this.stopScroll=function(t){t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation()},this.actionConfirm=function(){return this.has("options")&&!0!==this.callback(!1,this.args)||(this.add("lock","loading"),this.htmlSvgLoader(!1),apijs.html("div.btns").style.visibility="hidden",apijs.html("div.bbcode").style.visibility="hidden",self.setTimeout(function(){this.t2&&"FORM"===this.t2.nodeName?this.callback(this.t2.getAttribute("action"),this.args):this.t2&&this.callback(this.args)}.bind(this),12)),!1},this.onIframeLoad=function(t){t.removeAttribute("class"),apijs.dialog.remove("loading"),t.contentWindow.addEventListener("DOMMouseScroll",window.parent.apijs.dialog.onScrollIframe,{passive:!1}),t.contentWindow.addEventListener("mousewheel",window.parent.apijs.dialog.onScrollIframe,{passive:!1}),t.contentWindow.addEventListener("touchmove",window.parent.apijs.dialog.onScrollIframe,{passive:!1})},this.onMediaLoad=function(t){var e,i,s=apijs.dialog,a=s.media;t&&t.target&&(e=t.target.currentSrc||t.target.src,apijs.log("dialog:onMediaLoad:"+t.type+" "+(e?e.slice(e.lastIndexOf("/")+1):""))),a&&["load","durationchange"].has(t.type)?(s.remove("loading","error"),a.style.visibility="visible",a.hasAttribute("src")||"IMG"!==a.nodeName||a.setAttribute("src",a.imageLoader.src)):a&&"error"===t.type&&(s.toggle("loading","error"),a.removeAttribute("style"),(a=apijs.html(".tracks.video select"))&&t&&t.target&&0<(i=a.querySelectorAll("option")).length&&0<a.value.length&&(i[a.value].setAttribute("disabled","disabled"),a.selectedIndex+=1,"VIDEO"===t.target.nodeName&&""!==a.value&&apijs.player.actionVideo(a)))},this.onFullscreen=function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement;t&&apijs.log("dialog:onFullscreen:"+(e?"in":"out")),apijs.dialog[e?"add":"remove"]("fullscreen")},this.init=function(t,e,i){return"string"==typeof e?e=0<(e=e.replace(this.ft,"").trim()).length?!0===i?e+" lock":e:!0===i?"lock":null:!0===i&&(e="lock"),this.t0&&this.clear(!1),this.klass.push("start"),this.klass.push(t),self.matchMedia("prefers-reduced-motion:reduce").matches&&this.klass.push("reduce"),"string"==typeof e&&(this.klass=this.klass.concat(e.split(" "))),this.t0=document.createDocumentFragment(),document.addEventListener("keydown",apijs.dialog.onKey),self.addEventListener("beforeunload",apijs.dialog.onCloseBrowser),self.addEventListener("DOMMouseScroll",apijs.dialog.onScrollBrowser,{passive:!1}),self.addEventListener("mousewheel",apijs.dialog.onScrollBrowser,{passive:!1}),self.addEventListener("touchmove",apijs.dialog.onScrollBrowser,{passive:!1}),self.addEventListener("resize",apijs.dialog.onResizeBrowser),apijs.config.dialog.restrictNavigation&&document.querySelectorAll(this.ti).forEach(function(t){t.setAttribute("tabindex","-1")}),this},this.show=function(t){return this.onResizeBrowser(),this.onFullscreen(),0<this.height&&!this.has("photo","video")&&(this.t2.style.minHeight=this.height+"px"),apijs.html("#Dialog")?(this.toggle("start","ready"),this.t1=apijs.html("#Dialog"),this.t1.appendChild(this.t0.firstChild.firstChild),this.t1.setAttribute("class",this.t2.getAttribute("class"))):this.has("notransition")?(this.toggle("start","ready"),document.querySelector("body").appendChild(this.t0)):(document.querySelector("body").appendChild(this.t0),self.setTimeout(function(){apijs.dialog.toggle("start","ready")},12)),apijs.config.dialog.closeOnClick&&!this.has("progress","waiting","lock")&&document.addEventListener("click",apijs.dialog.actionClose),this.has("photo","video")&&(document.webkitFullscreenEnabled?document.addEventListener("webkitfullscreenchange",apijs.dialog.onFullscreen):document.fullscreenEnabled?document.addEventListener("fullscreenchange",apijs.dialog.onFullscreen):document.mozFullScreenEnabled&&document.addEventListener("mozfullscreenchange",apijs.dialog.onFullscreen)),!0===t?self.setTimeout(function(){apijs.html("input:not([readonly]),textarea:not([readonly]),select:not([disabled])").focus()},12):"string"==typeof t&&apijs.html(t).focus(),!0},this.clear=function(t){return t&&this.xhr&&(this.callback=null,this.xhr.abort()),document.removeEventListener("keydown",apijs.dialog.onKey),self.removeEventListener("beforeunload",apijs.dialog.onCloseBrowser),self.removeEventListener("DOMMouseScroll",apijs.dialog.onScrollBrowser,{passive:!1}),self.removeEventListener("mousewheel",apijs.dialog.onScrollBrowser,{passive:!1}),self.removeEventListener("touchmove",apijs.dialog.onScrollBrowser,{passive:!1}),self.removeEventListener("resize",apijs.dialog.onResizeBrowser),apijs.config.dialog.restrictNavigation&&document.querySelectorAll(this.ti).forEach(function(t){t.removeAttribute("tabindex")}),apijs.config.dialog.closeOnClick&&document.removeEventListener("click",apijs.dialog.actionClose),this.has("photo","video")&&(document.webkitFullscreenEnabled?document.removeEventListener("webkitfullscreenchange",apijs.dialog.onFullscreen):document.fullscreenEnabled?document.removeEventListener("fullscreenchange",apijs.dialog.onFullscreen):document.mozFullScreenEnabled&&document.removeEventListener("mozfullscreenchange",apijs.dialog.onFullscreen)),this.has("video")&&(this.media.ondurationchange=null,this.media.onerror=null),this.has("photo","video")||(this.height=parseFloat(self.getComputedStyle(this.t2).height)),t?(this.toggle("ready","end"),document.querySelector("body").removeChild(this.t1)):this.t1.removeChild(this.t2),this.klass=[],t&&(this.height=0,this.scroll=0,this.callback=null,this.args=null,this.xhr=null),this.media=null,this.t0=null,this.t1=null,this.t2=null,this.a=null,this.b=null,this.c=null,!(this.d=null)},this.htmlParent=function(t,e){return this.t1=document.createElement("div"),this.t1.setAttribute("id","apijsDialog"),"string"==typeof t?(this.t2=document.createElement("form"),this.t2.setAttribute("action",t),this.t2.setAttribute("method","post"),this.t2.setAttribute("enctype","multipart/form-data"),this.t2.setAttribute("onsubmit","return "+e)):this.t2=document.createElement("div"),this.t2.setAttribute("id","apijsBox"),this.t1.appendChild(this.t2),this.t0.appendChild(this.t1),this},this.htmlContent=function(t,e){return 0<t.length&&(this.a=document.createElement("h1"),this.a.innerHTML=t.replace(/</g,"<").replace(/>/g,">").replace(/\[/g,"<").replace(/]/g,">"),this.t2.appendChild(this.a)),0<e.length&&(this.a=document.createElement("div"),this.a.setAttribute("class","bbcode"),"["!==e[0]&&(e="[p]"+e+"[/p]"),this.a.innerHTML=e.replace(/</g,"<").replace(/>/g,">").replace(/\[/g,"<").replace(/]/g,">"),this.a.querySelectorAll("a.popup").forEach(function(t){t.addEventListener("click",apijs.openTab)}),this.t2.appendChild(this.a)),this},this.htmlBtnOk=function(){return this.a=document.createElement("div"),this.a.setAttribute("class","btns"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","confirm"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(102)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnConfirm=function(t,e){return this.a=document.createElement("div"),this.a.setAttribute("class","btns"),this.b=document.createElement("button"),this.b.setAttribute("type",t),this.b.setAttribute("class","confirm"),"submit"!==t&&this.b.setAttribute("onclick",e),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(104)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","cancel"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(103)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnNavigation=function(){return this.a=document.createElement("div"),this.a.setAttribute("class","navigation noplaying"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("disabled","disabled"),this.b.setAttribute("class","prev"),this.b.setAttribute("id","apijsPrev"),this.b.setAttribute("onclick","apijs.slideshow.actionPrev();"),this.c=document.createElement("span"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("disabled","disabled"),this.b.setAttribute("class","next"),this.b.setAttribute("id","apijsNext"),this.b.setAttribute("onclick","apijs.slideshow.actionNext();"),this.c=document.createElement("span"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnClose=function(t){return!1===t||(this.a=document.createElement("div"),this.a.setAttribute("class","close noplaying"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","close"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(105)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a)),this},this.htmlUpload=function(t,e){return this.a=document.createElement("div"),this.a.setAttribute("class","btns upload"),this.b=document.createElement("input"),this.b.setAttribute("type","file"),this.b.setAttribute("name",t),this.b.setAttribute("id","apijsFile"),e&&this.b.setAttribute("multiple","multiple"),this.b.setAttribute("onchange","apijs.upload.actionChoose(this);"),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","browse"),this.b.setAttribute("onclick","this.previousSibling.click();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(e?109:108)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("div"),this.b.setAttribute("class","filenames"),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgProgress=function(){return this.a=document.createElement("span"),this.a.setAttribute("class","info"),this.t2.appendChild(this.a),this.a=document.createElement("svg"),this.a.setAttribute("id","apijsProgress"),this.b=document.createElement("rect"),this.b.setAttribute("class","auto"),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgLoader=function(t){return this.a=document.createElementNS(this.ns,"svg"),this.a.setAttribute("class","loader"),this.b=document.createElementNS(this.ns,"path"),!1!==t&&this.b.setAttribute("style","opacity:0;"),this.b.setAttribute("d","M75.4 126.63a11.43 11.43 0 0 1-2.1-22.65 40.9 40.9 0 0 0 30.5-30.6 11.4 11.4 0 1 1 22.27 4.87h.02a63.77 63.77 0 0 1-47.8 48.05v-.02a11.38 11.38 0 0 1-2.93.37z"),this.c=document.createElementNS(this.ns,"animateTransform"),this.c.setAttribute("attributeName","transform"),this.c.setAttribute("type","rotate"),this.c.setAttribute("from","0 64 64"),this.c.setAttribute("to","360 64 64"),this.c.setAttribute("dur","5s"),this.c.setAttribute("repeatCount","indefinite"),this.b.appendChild(this.c),this.c=document.createElementNS(this.ns,"animate"),this.c.setAttribute("attributeName","opacity"),this.c.setAttribute("to","1"),this.c.setAttribute("dur","0.01s"),this.c.setAttribute("begin","1s"),this.c.setAttribute("fill","freeze"),!1!==t&&this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgPlayer=function(t){return this.a=document.createElement("span"),this.a.setAttribute("class","player noplaying"),this.b=document.createElement("span"),this.b.setAttribute("class","btn play fnt"),this.b.setAttribute("onclick","apijs.dialog.onKey(80);"),this.b.appendChild(document.createTextNode("")),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","svg bar"),this.c=document.createElement("svg"),this.c.setAttribute("class","bar"),this.c.setAttribute("onclick","apijs.player.actionPosition(event);"),this.d=document.createElement("rect"),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","time"),this.b.appendChild(document.createTextNode("00:00 / 00:00")),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","svg vol nomobile"),this.c=document.createElement("svg"),this.c.setAttribute("class","vol"),this.c.setAttribute("onclick","apijs.player.actionVolume(event);"),this.d=document.createElement("rect"),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks audiotrack"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(133)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionAudiotrack(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks videotrack"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(132)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionVideotrack(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks video"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(131)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionVideo(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks text"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(134)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionText(this);"),this.d=document.createElement("option"),this.d.appendChild(apijs.i18n.translateNode(135)),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","btn full fnt nomobile"),this.b.setAttribute("onclick","apijs.dialog.onKey(122);"),this.b.appendChild(document.createTextNode("")),this.a.appendChild(this.b),t.appendChild(this.a),this},this.htmlMedia=function(t,e,i,s){var a;return this.a=document.createElement("dl"),this.a.setAttribute("class","media"),this.b=document.createElement("dt"),this.has("photo")?(this.media=document.createElement("img"),this.media.setAttribute("alt",s.replace('"',""))):0<t.indexOf("iframe")?(this.media=document.createElement("iframe"),this.media.setAttribute("type","text/html"),this.media.setAttribute("scrolling","no"),this.media.setAttribute("src",t)):(this.media=document.createElement("video"),this.media.setAttribute("controls","controls"),this.media.setAttribute("preload","metadata"),this.media.setAttribute("onclick","apijs.dialog.onKey(80);")),this.media.setAttribute("id","apijsMedia"),this.b.appendChild(this.media),this.a.appendChild(this.b),this.b=document.createElement("dd"),this.b.setAttribute("class","nomobile noplaying"),"false"===e&&"false"===i||(a=t.slice(t.lastIndexOf("/")+1),this.c=document.createElement("span"),"false"!==e&&"auto"!==e&&"false"!==i?this.c.appendChild(document.createTextNode(e+" ("+i+") ")):"false"!==e&&"auto"!==e?this.c.appendChild(document.createTextNode(e+" ")):"auto"===e&&"false"!==i?this.c.appendChild(document.createTextNode(a+" ("+i+") ")):"auto"===e?this.c.appendChild(document.createTextNode(a+" ")):"false"!==i&&this.c.appendChild(document.createTextNode("("+i+") ")),this.b.appendChild(this.c)),this.b.appendChild(document.createTextNode(s)),this.a.appendChild(this.b),this.t2.appendChild(this.a),this.has("photo")?(this.media.imageLoader=new Image,this.media.imageLoader.src=t,this.media.imageLoader.onload=apijs.dialog.onMediaLoad,this.media.imageLoader.onerror=apijs.dialog.onMediaLoad):0<t.indexOf("iframe")?this.media.onload=apijs.dialog.onMediaLoad:!0===apijs.config.dialog.player?(this.media.setAttribute("class","player"),this.htmlSvgPlayer(this.media.parentNode),apijs.player=new apijs.core.player,apijs.player.init(this.media.parentNode,this.media,t),this.media.ondurationchange=apijs.dialog.onMediaLoad,this.media.onerror=apijs.dialog.onMediaLoad):"function"==typeof apijs.config.dialog.player?apijs.config.dialog.player(this.media,t):(this.c=document.createElement("source"),this.c.setAttribute("src",t),this.c.onerror=apijs.dialog.onMediaLoad,this.media.appendChild(this.c),this.media.ondurationchange=apijs.dialog.onMediaLoad,this.media.onerror=apijs.dialog.onMediaLoad),this},this.htmlHelp=function(t,e){var i,s,a=[t?["start",149,141]:[],t?["left","right",142]:[],e?["bottom","topk",144]:[],e?["minus","plus",145]:[],e?["M",146]:[],e?["P",143]:[],["F11",147],[150,148]];for(this.a=document.createElement("ul"),this.a.setAttribute("class","kbd nomobile nofullscreen");i=a.shift();)if(0<i.length){for(this.b=document.createElement("li");s=i.shift();)0<i.length?(this.c=document.createElement("kbd"),["M","P","F11"].has(s)?this.c.appendChild(document.createTextNode(s)):"string"==typeof s?this.c.setAttribute("class",s):this.c.appendChild(apijs.i18n.translateNode(s)),this.b.appendChild(this.c)):this.b.appendChild(apijs.i18n.translateNode(s));this.a.appendChild(this.b)}return this.t2.appendChild(this.a),this},this.htmlIframe=function(t){return this.a=document.createElement("iframe"),this.a.setAttribute("src",t),this.a.setAttribute("class","loading"),this.a.setAttribute("onload","apijs.dialog.onIframeLoad(this);"),this.t2.appendChild(this.a),this}},apijs.core.slideshow=function(){"use strict";this.current=null,this.init=function(){for(var t,e,i,s=apijs.config.slideshow.ids,a=0;e=apijs.html(s+"."+a);a++){for(i=e.classList.contains("hoverload"),t=0;e=apijs.html(s+"."+a+"."+t);t++)e.addEventListener("click",apijs.slideshow.show),i&&e.addEventListener("mouseover",apijs.slideshow.show);(e=apijs.html(s+"."+a+".99999"))&&e.addEventListener("click",apijs.slideshow.show)}this.onPopState()},this.onPopState=function(){var t;new RegExp("#("+apijs.config.slideshow.ids+"[-\\.]\\d+[-\\.]\\d+)").test(self.location.href)?(t=RegExp.$1.replace(/-/g,"."),apijs.html(t)&&!apijs.dialog.has("slideshow")&&apijs.slideshow.show(t,!1)):apijs.slideshow.current&&apijs.dialog.actionClose()},this.show=function(t,e){var i,s,a,n=!1,o={};if("string"==typeof t)n=!0,i=apijs.html(t),o.id=t;else{for(t.preventDefault(),i=t.target;"A"!==i.nodeName;)i=i.parentNode;if("mouseover"===t.type&&i.classList.contains("current"))return!1;o.id=i.getAttribute("id")}return o.prefix=apijs.config.slideshow.ids+"."+o.id.split(".")[1],o.number=parseInt(o.id.split(".")[2],10),o.gallery=apijs.html(o.prefix+".99999"),99999!==o.number&&(t=apijs.html(o.prefix).querySelectorAll("a[id][type]"),a=apijs.html(o.prefix).querySelectorAll("dl"),o.gallery||t.length!==a.length?(t.forEach(function(t){t.classList.remove("current")}),i.setAttribute("class","current")):(a.forEach(function(t){t.classList.remove("current")}),i.parentNode.parentNode.setAttribute("class","current"))),o.gallery?(99999===o.number&&(n=!0,i=o.gallery.hasAttribute("class")?o.gallery.getAttribute("class"):o.prefix+".0",i=apijs.html(i),o.number=parseInt(i.getAttribute("id").split(".")[2],10),o.id=o.id.replace(99999,o.number)),o.config=i.querySelector("input").getAttribute("value").split("|"),0<(a=o.config.shift()).indexOf(";")&&(s=(a=a.split(";"))[1].trim(),a=a[0].trim()),o.gallery.setAttribute("href",i.getAttribute("href")),o.gallery.querySelector("img").setAttribute("src",a),o.gallery.querySelector("img").setAttribute("srcset",s||""),o.gallery.querySelector("img").setAttribute("alt",i.querySelector("img").getAttribute("alt")),o.gallery.setAttribute("class",o.id)):(n=!0,o.config=i.querySelector("input").getAttribute("value").split("|")),o.url=i.getAttribute("href"),o.type=i.getAttribute("type").substr(0,5).replace("image","dialogPhoto").replace("video","dialogVideo"),o.type=0===o.type.indexOf("dialog")?o.type:"dialogPhoto",o.styles=apijs.html(o.prefix).getAttribute("class").replace(/gallery|album/g,"").trim(),n&&(apijs.dialog[o.type](o.url,o.config[0],o.config[1],o.config[2],o.styles),s=apijs.html(o.prefix).querySelectorAll("a[id][type]").length-(o.gallery?2:1),apijs.slideshow.current={number:o.number,first:o.prefix+".0",prev:0<o.number?o.prefix+"."+(o.number-1):null,next:o.number<s?o.prefix+"."+(o.number+1):null,last:o.prefix+"."+s,total:s},apijs.slideshow.current.prev&&apijs.html("#Prev").removeAttribute("disabled"),apijs.slideshow.current.next&&apijs.html("#Next").removeAttribute("disabled"),apijs.config.slideshow.anchor&&"function"==typeof history.pushState&&("boolean"!=typeof e||e)&&(e=0<(e=self.location.href).indexOf("#")?e.slice(0,e.indexOf("#")):e,e+="#"+(o.prefix+"."+(99999===o.number?0:o.number)).replace(/\./g,"-"),history.pushState({},"",e))),n},this.actionFirst=function(){return!!(this.current&&0<this.current.number&&this.current.number<=this.current.total)&&this.show(this.current.first)},this.actionPrev=function(){return!!(this.current&&this.current.prev&&0<this.current.number)&&this.show(this.current.prev)},this.actionNext=function(){return!!(this.current&&this.current.next&&this.current.number<this.current.total)&&this.show(this.current.next)},this.actionLast=function(){return!!(this.current&&0<=this.current.number&&this.current.number<this.current.total)&&this.show(this.current.last)}},apijs.core.upload=function(){"use strict";this.title=null,this.action=null,this.input=null,this.onemax=0,this.allmax=0,this.exts=null,this.callback=null,this.args=null,this.icon=null,this.files=[],this.start=0,this.end=0,this.sendFile=function(t,e,i,s,a,n,o,r){r=this.sendFiles(t,e,i,s,0,a,n,o,r);return r||console.error("apijs.upload.sendFile invalid arguments",apijs.toArray(arguments)),r},this.sendFiles=function(t,e,i,s,a,n,o,r,l){if(this.files=[],!0!==t&&(this.title=t,this.action=e,this.input=i,this.onemax=s,this.allmax=a,this.exts="string"==typeof n?n.split(","):["*"],this.callback=o,this.args=r,this.icon=l),"string"!=typeof this.title||"string"!=typeof this.action||"string"!=typeof this.input||"number"!=typeof this.onemax||"number"!=typeof this.allmax||"function"!=typeof this.callback)return("number"!=typeof this.allmax||0<this.allmax)&&console.error("apijs.upload.sendFiles invalid arguments",apijs.toArray(arguments)),!1;r=0<this.allmax,l="*"===this.exts.join()?apijs.i18n.translate(161):1===this.exts.length?apijs.i18n.translate(162,this.exts.join()):apijs.i18n.translate(163,this.exts.slice(0,-1).join(", "),this.exts.slice(-1));return l+="[br]"+apijs.i18n.translate(r?165:164,apijs.formatNumber(this.onemax),r?apijs.formatNumber(this.allmax):"").replace("|","[br]"),apijs.dialog.dialogFormUpload(this.title,l,this.action,this.input,r,this.icon)},this.actionChoose=function(t){var e,i=[],s=0;this.files=[],this.exts&&(Array.prototype.forEach.call(t.files,function(t){e=t.name+' <span class="sz">'+apijs.i18n.translate(166,apijs.formatNumber(t.size/1048576))+"</span>","*"===this.exts.join()||this.exts.has(t.name.slice(t.name.lastIndexOf(".")+1).toLowerCase())?t.size>1048576*this.onemax?e+=' <span class="ee">'+apijs.i18n.translate(168)+"</span>":t.size<=0?e+=' <span class="ee">'+apijs.i18n.translate(169)+"</span>":this.files.push(t):e+=' <span class="ee">'+apijs.i18n.translate(167)+"</span>",i.push("<div>"+e+"</div>"),s+=t.size/1048576},this),0<this.allmax&&s>=this.allmax&&i.push('<div class="tt"> = <span class="sz">'+apijs.i18n.translate(166,apijs.formatNumber(s))+'</span> <span class="ee">'+apijs.i18n.translate(168)+"</span></div>"),this.files.length===t.files.length?(apijs.html("button.confirm").removeAttribute("disabled"),apijs.html("button.confirm").focus()):apijs.html("button.confirm").setAttribute("disabled","disabled"),apijs.html("div.filenames").innerHTML=i.join(" "))},this.actionConfirm=function(){var s,e;return 0<this.files.length?(s=new FormData,(e=new XMLHttpRequest).open("POST",this.action+(0<this.action.indexOf("?")?"&isAjax=true":"?isAjax=true"),!0),"string"==typeof apijs.config.upload.tokenValue&&(e.setRequestHeader(apijs.config.upload.tokenName,apijs.config.upload.tokenValue),s.append(apijs.config.upload.tokenName,apijs.config.upload.tokenValue)),this.files.forEach(function(t,e,i){s.append(1<i.length&&this.input.indexOf("[")<0?this.input+"_"+e:this.input,t)},this),e.onreadystatechange=function(t){4===e.readyState&&(t=e.responseText.trim(),[0,200].has(e.status)?(self.dispatchEvent(new CustomEvent("apijsajaxresponse",{detail:{from:"apijs.upload.send",xhr:e}})),apijs.log("upload:onreadystatechange status:200 message:"+t),0===t.indexOf("success-")?(apijs.upload.updateTitle(),apijs.upload.callback(t.slice(8),apijs.upload.args)):apijs.upload.onError(195,t)):(apijs.log("upload:onreadystatechange status:"+e.status+" message: "+t),apijs.upload.onError(194,e.status)))},e.upload.onloadstart=apijs.upload.onStart.bind(this),e.upload.onprogress=apijs.upload.onProgress.bind(this),e.upload.onload=apijs.upload.onProgress.bind(this),e.upload.onerror=apijs.upload.onError.bind(this),e.send(s)):apijs.html("button.browse").focus(),!1},this.onStart=function(){this.start=this.end=Math.round((new Date).getTime()/1e3),apijs.dialog.dialogProgress(this.title,apijs.i18n.translate(125),this.icon)},this.onError=function(t,e){this.updateTitle(),"number"==typeof t?e="[p]"+apijs.i18n.translate(t)+"[/p] "+e:"string"!=typeof e&&(e="[p]"+apijs.i18n.translate(193)+"[/p]"),e+="[p]"+apijs.i18n.translate(196,'href="apijs://restart" onclick="apijs.upload.sendFile(true); return false;"')+"[/p]",apijs.dialog.dialogInformation(this.title,e,"string"==typeof this.icon?"upload error "+this.icon:"upload error")},this.onProgress=function(t){var e,i,s,a,n,o,r=Math.round((new Date).getTime()/1e3);t.lengthComputable&&"progress"===t.type&&r>=this.end+2?(this.end=r,0<(e=Math.floor(100*t.loaded/t.total))&&e<100&&(this.updateTitle(e),r=100*(n=r-this.start)/e+10,24<n&&(a=Math.round(r-n),a=10*Math.ceil(a/10),o=Math.ceil(a/60),s=Math.round(t.loaded/n/1024),n<40||r<90?(i=184,a=null):1<o?(i=181,a=o):50<a?(i=182,a=1):i=183),this.updateProgress(e,i,s,a))):"load"===t.type&&(a=Math.round((new Date).getTime()/1e3)-this.start,o=Math.ceil(a/60),0<(s=Math.round(t.loaded/a/1024))&&s!==1/0?1<o?(i=185,a=o):50<a?(i=186,a=1):20<a?i=187:(i=188,a=null):a=s=null,this.updateTitle(100),this.updateProgress(100,i,s,a))},this.updateProgress=function(t,e,i,s){var a,n=apijs.html("rect"),o=apijs.html("span.info");99<t?(a="100%",n.setAttribute("class","end"),n.style.width="",apijs.html("p").textContent=apijs.i18n.translate(126)):(n.style.width=a=t+"%",n.hasAttribute("class")&&n.removeAttribute("class")),"number"==typeof e&&"number"==typeof i&&"number"==typeof s?a=apijs.i18n.translate(e,t,apijs.formatNumber(i,!1),s):"number"==typeof e&&"number"==typeof i&&(a=apijs.i18n.translate(e,t,apijs.formatNumber(i,!1))),o.textContent=a},this.updateTitle=function(t){"number"==typeof t?document.title=/^\d{1,3}% - /.test(document.title)?t+"% - "+document.title.slice(document.title.indexOf(" - ")+3):t+"% - "+document.title:/^\d{1,3}% - /.test(document.title)&&(document.title=document.title.slice(document.title.indexOf(" - ")+3))}};
|
data/assets/javascripts/app.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* Created D/15/12/2013
|
3
|
-
* Updated
|
3
|
+
* Updated D/27/09/2020
|
4
4
|
*
|
5
5
|
* Copyright 2008-2020 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
6
6
|
* https://www.luigifab.fr/redmine/apijs
|
@@ -23,6 +23,7 @@ var apijsRedmine = new (function () {
|
|
23
23
|
this.start = function () {
|
24
24
|
|
25
25
|
var d = apijs.i18n.data;
|
26
|
+
if (!d.frca) d.frca = {};
|
26
27
|
// https://docs.google.com/spreadsheets/d/1UUpKZ-YAAlcfvGHYwt6aUM9io390j0-fIL0vMRh1pW0/edit?usp=sharing
|
27
28
|
// auto start
|
28
29
|
d.cs[252] = "Chyba";
|
@@ -33,26 +34,30 @@ var apijsRedmine = new (function () {
|
|
33
34
|
d.de[254] = "Es tut uns leid, diese Datei existiert nicht mehr, bitte [a §]aktualisieren Sie die Seite[/a].";
|
34
35
|
d.de[255] = "Eine Beschreibung bearbeiten";
|
35
36
|
d.de[256] = "Bitte geben Sie weiter unten die neue Beschreibung für diese Datei an. Um die Beschreibung zu löschen lassen Sie das Feld leer.";
|
36
|
-
d.en[250] = "Remove
|
37
|
+
d.en[250] = "Remove file";
|
37
38
|
d.en[251] = "Are you sure you want to remove this file?[br]Be careful, you can't cancel this operation.";
|
38
39
|
d.en[252] = "Error";
|
39
40
|
d.en[253] = "You are not authorized to perform this operation, please [a §]refresh the page[/a].";
|
40
41
|
d.en[254] = "Sorry, the file no longer exists, please [a §]refresh the page[/a].";
|
41
|
-
d.en[255] = "Edit
|
42
|
+
d.en[255] = "Edit description";
|
42
43
|
d.en[256] = "Enter below the new description for the file. To remove the description, leave the field empty.";
|
44
|
+
d.en[257] = "Rename file";
|
45
|
+
d.en[258] = "Enter below the new name for the file.";
|
43
46
|
d.es[250] = "Borrar un archivo";
|
44
|
-
d.es[251] = "¿Está usted seguro
|
47
|
+
d.es[251] = "¿Está usted seguro(a) de que desea eliminar este archivo?[br]Atención, pues no podrá cancelar esta operación.";
|
45
48
|
d.es[253] = "No está autorizado-a para llevar a cabo esta operación, por favor [a §]actualice la página[/a].";
|
46
49
|
d.es[254] = "Disculpe, pero el archivo ya no existe, por favor [a §]actualice la página[/a].";
|
47
50
|
d.es[255] = "Editar una descripción";
|
48
51
|
d.es[256] = "Introduzca a continuación la nueva descripción para el archivo. Para eliminar la descripción, deje el campo en blanco.";
|
49
|
-
d.fr[250] = "Supprimer
|
50
|
-
d.fr[251] = "Êtes-vous
|
52
|
+
d.fr[250] = "Supprimer le fichier";
|
53
|
+
d.fr[251] = "Êtes-vous sûr(e) de vouloir supprimer ce fichier ?[br]Attention, cette opération n'est pas annulable.";
|
51
54
|
d.fr[252] = "Erreur";
|
52
55
|
d.fr[253] = "Vous n'êtes pas autorisé(e) à effectuer cette opération, veuillez [a §]actualiser la page[/a].";
|
53
56
|
d.fr[254] = "Désolé, le fichier n'existe plus, veuillez [a §]actualiser la page[/a].";
|
54
|
-
d.fr[255] = "Modifier
|
57
|
+
d.fr[255] = "Modifier la description";
|
55
58
|
d.fr[256] = "Saisissez ci-dessous la nouvelle description pour ce fichier. Pour supprimer la description, laissez le champ vide.";
|
59
|
+
d.fr[257] = "Renommer le fichier";
|
60
|
+
d.fr[258] = "Saisissez ci-dessous le nouveau nom pour ce fichier.";
|
56
61
|
d.it[250] = "Eliminare un file";
|
57
62
|
d.it[251] = "Sicuri di voler eliminare il file?[br]Attenzione, questa operazione non può essere annullata.";
|
58
63
|
d.it[252] = "Errore";
|
@@ -65,7 +70,7 @@ var apijsRedmine = new (function () {
|
|
65
70
|
d.nl[252] = "Fout";
|
66
71
|
d.pl[252] = "Błąd";
|
67
72
|
d.pt[250] = "Suprimir um ficheiro";
|
68
|
-
d.pt[251] = "Tem certeza de que quer suprimir este ficheiro?[br]
|
73
|
+
d.pt[251] = "Tem certeza de que quer suprimir este ficheiro?[br]Cuidado, não pode cancelar esta operação.";
|
69
74
|
d.pt[252] = "Erro";
|
70
75
|
d.pt[253] = "Não é autorizado(a) para efetuar esta operação, por favor [a §]atualize a página[/a].";
|
71
76
|
d.pt[254] = "Lamento, o ficheiro já não existe, por favor [a §]atualize a página[/a].";
|
@@ -78,14 +83,15 @@ var apijsRedmine = new (function () {
|
|
78
83
|
d.ru[254] = "Извините, но файл не существует, пожалуйста [a §]обновите страницу[/a].";
|
79
84
|
d.ru[255] = "Редактировать описание";
|
80
85
|
d.ru[256] = "Ниже введите новое описание файла. Оставьте поле пустым, чтобы удалить описание.";
|
86
|
+
d.sk[252] = "Chyba";
|
81
87
|
d.tr[252] = "Hata";
|
82
88
|
d.zh[252] = "错误信息";
|
83
|
-
|
89
|
+
// auto end
|
84
90
|
};
|
85
91
|
|
86
92
|
this.error = function (data) {
|
87
93
|
|
88
|
-
if ((typeof data == 'string')
|
94
|
+
if ((typeof data == 'string') && (data.indexOf('<!DOCTYPE') < 0)) {
|
89
95
|
apijs.dialog.dialogInformation(apijs.i18n.translate(252), data, 'error');
|
90
96
|
}
|
91
97
|
else {
|
@@ -94,24 +100,15 @@ var apijsRedmine = new (function () {
|
|
94
100
|
}
|
95
101
|
};
|
96
102
|
|
97
|
-
this.editAttachment = function (id, action, token) {
|
103
|
+
this.editAttachment = function (elem, id, action, token) {
|
98
104
|
|
99
105
|
var desc, text, title = apijs.i18n.translate(255);
|
100
|
-
if (document.getElementById('attachmentId' + id).querySelector('span.description')) {
|
101
|
-
desc = document.getElementById('attachmentId' + id).querySelector('span.description').firstChild.nodeValue.trim();
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
desc = document.createElement('span');
|
105
|
-
desc.setAttribute('class', 'description');
|
106
|
-
desc.appendChild(document.createTextNode(''));
|
107
|
-
document.getElementById('attachmentId' + id).querySelector('dd').appendChild(desc);
|
108
|
-
desc = '';
|
109
|
-
}
|
110
106
|
|
111
|
-
|
112
|
-
|
107
|
+
desc = elem.parentNode.parentNode.querySelector('.description').textContent.trim();
|
108
|
+
text = '[p][label for="apijsinput"]' + apijs.i18n.translate(256) + '[/label][/p]' +
|
109
|
+
'[input type="text" name="description" value="' + desc + '" spellcheck="true" id="apijsinput"]';
|
113
110
|
|
114
|
-
apijs.dialog.dialogFormOptions(title, text, action, apijsRedmine.actionEditAttachment, [id, action, token], '
|
111
|
+
apijs.dialog.dialogFormOptions(title, text, action, apijsRedmine.actionEditAttachment, [id, action, token], 'editattach');
|
115
112
|
apijs.dialog.t1.querySelector('input').select();
|
116
113
|
};
|
117
114
|
|
@@ -141,19 +138,97 @@ var apijsRedmine = new (function () {
|
|
141
138
|
id = xhr.responseText.slice(0, xhr.responseText.indexOf(':'));
|
142
139
|
text = xhr.responseText.slice(xhr.responseText.indexOf(':') + 1);
|
143
140
|
|
144
|
-
//
|
145
|
-
elem = document.getElementById(id)
|
146
|
-
elem.
|
141
|
+
// description
|
142
|
+
elem = document.getElementById(id);
|
143
|
+
elem.querySelector('.description').textContent = text;
|
147
144
|
|
148
145
|
// input type hidden
|
149
|
-
elem =
|
146
|
+
elem = elem.querySelector('input');
|
150
147
|
if (elem)
|
151
148
|
elem.value = elem.value.slice(0, elem.value.lastIndexOf('|') + 1) + text;
|
152
149
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
150
|
+
apijs.dialog.actionClose();
|
151
|
+
}
|
152
|
+
else {
|
153
|
+
apijsRedmine.error(xhr.responseText);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
apijsRedmine.error(xhr.status);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
};
|
161
|
+
|
162
|
+
xhr.send('desc=' + encodeURIComponent(document.getElementById('apijsinput').value));
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|
166
|
+
this.renameAttachment = function (elem, id, action, token) {
|
167
|
+
|
168
|
+
var name, text, title = apijs.i18n.translate(257);
|
169
|
+
|
170
|
+
name = elem.parentNode.parentNode.querySelector('.filename').textContent.trim();
|
171
|
+
text = '[p][label for="apijsinput"]' + apijs.i18n.translate(258) + '[/label][/p]' +
|
172
|
+
'[input type="text" name="name" value="' + name + '" spellcheck="false" id="apijsinput"]';
|
173
|
+
|
174
|
+
apijs.dialog.dialogFormOptions(title, text, action, apijsRedmine.actionRenameAttachment, [id, action, token], 'editattach');
|
175
|
+
};
|
176
|
+
|
177
|
+
this.actionRenameAttachment = function (action, args) {
|
178
|
+
|
179
|
+
// vérification du nouveau nom
|
180
|
+
if (typeof action == 'boolean') {
|
181
|
+
return true;
|
182
|
+
}
|
183
|
+
// sauvegarde du nouveau nom
|
184
|
+
else if (typeof action == 'string') {
|
185
|
+
|
186
|
+
// args = [id, action, token]
|
187
|
+
var xhr = new XMLHttpRequest();
|
188
|
+
xhr.open('POST', args[1] + '?id=' + args[0] + '&isAjax=true', true);
|
189
|
+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
190
|
+
xhr.setRequestHeader('X-CSRF-Token', args[2]);
|
191
|
+
|
192
|
+
xhr.onreadystatechange = function () {
|
193
|
+
|
194
|
+
if (xhr.readyState === 4) {
|
195
|
+
if ([0, 200].has(xhr.status)) {
|
196
|
+
if (xhr.responseText.indexOf('attachmentId') === 0) {
|
197
|
+
|
198
|
+
// extrait l'id et le nom du fichier enregistré
|
199
|
+
var elem, id, name, subelem, text;
|
200
|
+
id = xhr.responseText.slice(0, xhr.responseText.indexOf(':'));
|
201
|
+
name = xhr.responseText.slice(xhr.responseText.indexOf(':') + 1);
|
202
|
+
|
203
|
+
// nom
|
204
|
+
elem = document.getElementById(id);
|
205
|
+
elem.querySelector('.filename').textContent = name;
|
206
|
+
|
207
|
+
// urls sur a/href et input/value et button.download/onclick et button.show/onclick
|
208
|
+
// pas de maj de src et srcset sur img pour éviter un appel réseau inutile
|
209
|
+
subelem = elem.querySelector('input');
|
210
|
+
if (subelem) {
|
211
|
+
text = subelem.getAttribute('value');
|
212
|
+
subelem.setAttribute('value', name + text.substr(text.indexOf('|')));
|
213
|
+
}
|
214
|
+
|
215
|
+
subelem = elem.querySelector('a');
|
216
|
+
if (subelem) {
|
217
|
+
text = subelem.getAttribute('href');
|
218
|
+
subelem.setAttribute('href', text.substr(0, text.lastIndexOf('/') + 1) + name);
|
219
|
+
}
|
220
|
+
|
221
|
+
subelem = elem.querySelector('button.download');
|
222
|
+
if (subelem) {
|
223
|
+
text = subelem.getAttribute('onclick');
|
224
|
+
subelem.setAttribute('onclick', text.substr(0, text.lastIndexOf('/') + 1) + name + "';");
|
225
|
+
}
|
226
|
+
|
227
|
+
subelem = elem.querySelector('button.show');
|
228
|
+
if (subelem) {
|
229
|
+
text = subelem.getAttribute('onclick');
|
230
|
+
subelem.setAttribute('onclick', text.substr(0, text.lastIndexOf('/') + 1) + name + "';");
|
231
|
+
}
|
157
232
|
|
158
233
|
apijs.dialog.actionClose();
|
159
234
|
}
|
@@ -167,11 +242,11 @@ var apijsRedmine = new (function () {
|
|
167
242
|
}
|
168
243
|
};
|
169
244
|
|
170
|
-
xhr.send('
|
245
|
+
xhr.send('name=' + encodeURIComponent(document.getElementById('apijsinput').value));
|
171
246
|
}
|
172
247
|
};
|
173
248
|
|
174
|
-
this.removeAttachment = function (id, action, token) {
|
249
|
+
this.removeAttachment = function (elem, id, action, token) {
|
175
250
|
apijs.dialog.dialogConfirmation(apijs.i18n.translate(250), apijs.i18n.translate(251), apijsRedmine.actionRemoveAttachment, [id, action, token]);
|
176
251
|
};
|
177
252
|
|
@@ -179,7 +254,7 @@ var apijsRedmine = new (function () {
|
|
179
254
|
|
180
255
|
// args = [id, action, token]
|
181
256
|
var xhr = new XMLHttpRequest();
|
182
|
-
xhr.open('
|
257
|
+
xhr.open('POST', args[1] + '?id=' + args[0] + '&isAjax=true', true);
|
183
258
|
xhr.setRequestHeader('X-CSRF-Token', args[2]);
|
184
259
|
|
185
260
|
xhr.onreadystatechange = function () {
|
@@ -189,17 +264,17 @@ var apijsRedmine = new (function () {
|
|
189
264
|
if (xhr.responseText.indexOf('attachmentId') === 0) {
|
190
265
|
|
191
266
|
// supprime le fichier de la page grâce à son id
|
192
|
-
var attachment = document.getElementById(xhr.responseText),
|
193
|
-
|
267
|
+
var attachment = document.getElementById(xhr.responseText), elems = attachment.parentNode, idx = 0;
|
268
|
+
elems.removeChild(attachment);
|
194
269
|
|
195
|
-
|
196
|
-
|
197
|
-
|
270
|
+
// supprime la liste des fichiers
|
271
|
+
if (elems.querySelectorAll('dl, li').length < 1) {
|
272
|
+
elems.parentNode.removeChild(elems);
|
198
273
|
}
|
274
|
+
// ou réattribue les ids du diaporama (pas de réinitialisation, on remet juste les ids en place)
|
199
275
|
else {
|
200
|
-
|
201
|
-
|
202
|
-
elem.setAttribute('id', elem.getAttribute('id').slice(0, elem.getAttribute('id').lastIndexOf('.') + 1) + i++);
|
276
|
+
elems.querySelectorAll('a[id][type]').forEach(function (elem) {
|
277
|
+
elem.setAttribute('id', elem.getAttribute('id').slice(0, elem.getAttribute('id').lastIndexOf('.') + 1) + idx++);
|
203
278
|
});
|
204
279
|
}
|
205
280
|
|