Skip to content

Commit 35fbfaf

Browse files
committed
# Conflicts: # plugin.info.txt
2 parents 6c6386f + 02d3622 commit 35fbfaf

File tree

4 files changed

+88
-48
lines changed

4 files changed

+88
-48
lines changed

lang/fr/lang.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* French language file for imgpaste plugin
4+
*
5+
* @author Schplurtz le Déboulonné <[email protected]>
6+
*/
7+
8+
$lang['e_nodata'] = 'Le presse-papier est vide.';
9+
$lang['js']['inprogress'] = 'Envoi en cours… Veuillez patienter.';
10+
11+
//Setup VIM: ex: et ts=4 :

lang/fr/settings.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* French language file for imgpaste plugin
4+
*
5+
* @author Schplurtz le Déboulonné <[email protected]>
6+
*/
7+
8+
// keys need to match the config setting name
9+
$lang['filename'] = 'Comment nommer les images collées. Vous pouvez utiliser les motifs @USER@, @NS@, @ID@, ansi que des formats de strftime. Imgpaste ajoutera automatiquement la bonne extension au nom du fichier.';
10+
11+
//Setup VIM: ex: et ts=4 :

plugin.info.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
base imgpaste
22
author Andreas Gohr
33
4+
<<<<<<< HEAD
45
date 2016-09-20
6+
=======
7+
date 2017-09-24
8+
>>>>>>> 02d362229275b1bdd8bf705f313142c5ebef8a51
59
name imgpaste plugin
610
desc Add images via cut'n'paste in Chrome
711
url http://www.dokuwiki.org/plugin:imgpaste

script.js

Lines changed: 62 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,67 @@
11
/* DOKUWIKI:include jquery.paste_image_reader.js */
22

33
jQuery(function () {
4-
if (!jQuery('#wiki__text').length) return;
5-
6-
jQuery('html').pasteImageReader({
7-
callback: function (x) {
8-
console.log(x);
9-
10-
// create dialog
11-
var offset = jQuery('.plugin_imagepaste').length * 20;
12-
var $box = jQuery('<div><div class="content">' + LANG.plugins.imgpaste.inprogress + '</div></div>');
13-
$box.dialog({
14-
title: 'Upload',
15-
dialogClass: 'plugin_imagepaste',
16-
closeOnEscape: false,
17-
resizable: false,
18-
position: {
19-
my: 'center+' + offset + ' center+' + offset
20-
},
21-
appendTo: '.dokuwiki'
22-
});
23-
24-
// upload via AJAX
25-
jQuery.ajax({
26-
url: DOKU_BASE + 'lib/exe/ajax.php',
27-
type: 'POST',
28-
data: {
29-
call: 'plugin_imgpaste',
30-
data: x.dataURL,
31-
id: JSINFO.id
32-
},
33-
34-
// insert syntax and close dialog
35-
success: function (data) {
36-
$box.find('.content').addClass('success').text(data.message);
37-
insertAtCarret('wiki__text', '{{:' + data.id + '}}');
38-
$box.delay(500).fadeOut(500, function () {
39-
$box.dialog('destroy').remove()
40-
});
41-
},
42-
43-
// display error and close dialog
44-
error: function (xhr, status, error) {
45-
$box.find('.content').addClass('error').text(error);
46-
$box.delay(1000).fadeOut(500, function () {
47-
$box.dialog('destroy').remove()
48-
});
49-
}
50-
});
4+
var _didInit = false;
5+
function init() {
6+
if (!jQuery('#wiki__text').length || _didInit) return;
7+
_didInit = true;
8+
jQuery('html').pasteImageReader({
9+
callback: function (x) {
10+
if (!jQuery('#wiki__text').length) return;
11+
12+
console.log(x);
13+
14+
// create dialog
15+
var offset = jQuery('.plugin_imagepaste').length * 20;
16+
var $box = jQuery('<div><div class="content">' + LANG.plugins.imgpaste.inprogress + '</div></div>');
17+
$box.dialog({
18+
title: 'Upload',
19+
dialogClass: 'plugin_imagepaste',
20+
closeOnEscape: false,
21+
resizable: false,
22+
position: {
23+
my: 'center+' + offset + ' center+' + offset
24+
},
25+
appendTo: '.dokuwiki'
26+
});
27+
28+
// upload via AJAX
29+
jQuery.ajax({
30+
url: DOKU_BASE + 'lib/exe/ajax.php',
31+
type: 'POST',
32+
data: {
33+
call: 'plugin_imgpaste',
34+
data: x.dataURL,
35+
id: JSINFO.id
36+
},
37+
38+
// insert syntax and close dialog
39+
success: function (data) {
40+
$box.find('.content').addClass('success').text(data.message);
41+
insertAtCarret('wiki__text', '{{:' + data.id + '}}');
42+
$box.delay(500).fadeOut(500, function () {
43+
$box.dialog('destroy').remove()
44+
});
45+
},
46+
47+
// display error and close dialog
48+
error: function (xhr, status, error) {
49+
$box.find('.content').addClass('error').text(error);
50+
$box.delay(1000).fadeOut(500, function () {
51+
$box.dialog('destroy').remove()
52+
});
53+
}
54+
});
55+
}
56+
});
57+
}
58+
59+
init();
60+
61+
// fastwiki plugin support
62+
jQuery(window).on('fastwiki:afterSwitch', function(evt, viewMode, isSectionEdit, prevViewMode) {
63+
if (viewMode == 'edit' || isSectionEdit) {
64+
init();
5165
}
5266
});
53-
});
67+
});

0 commit comments

Comments
 (0)