aboutsummaryrefslogtreecommitdiff
path: root/static/js/wpaint/plugins/file
diff options
context:
space:
mode:
authorLibravatar bai 2019-03-29 02:14:43 +0000
committerLibravatar bai 2019-03-29 02:14:43 +0000
commit95dfe14528663923ca2a88ec928f1d8d9df2402b (patch)
tree5bc88d1466957f1aa39043b056bde5c439648022 /static/js/wpaint/plugins/file
downloadweabot-95dfe14528663923ca2a88ec928f1d8d9df2402b.tar.gz
weabot-95dfe14528663923ca2a88ec928f1d8d9df2402b.tar.xz
weabot-95dfe14528663923ca2a88ec928f1d8d9df2402b.zip
Init
Diffstat (limited to 'static/js/wpaint/plugins/file')
-rw-r--r--static/js/wpaint/plugins/file/img/icons-menu-main-file.pngbin0 -> 835 bytes
-rw-r--r--static/js/wpaint/plugins/file/src/wPaint.menu.main.file.js75
-rw-r--r--static/js/wpaint/plugins/file/wPaint.menu.main.file.min.js1
3 files changed, 76 insertions, 0 deletions
diff --git a/static/js/wpaint/plugins/file/img/icons-menu-main-file.png b/static/js/wpaint/plugins/file/img/icons-menu-main-file.png
new file mode 100644
index 0000000..cda4bde
--- /dev/null
+++ b/static/js/wpaint/plugins/file/img/icons-menu-main-file.png
Binary files differ
diff --git a/static/js/wpaint/plugins/file/src/wPaint.menu.main.file.js b/static/js/wpaint/plugins/file/src/wPaint.menu.main.file.js
new file mode 100644
index 0000000..15cfa46
--- /dev/null
+++ b/static/js/wpaint/plugins/file/src/wPaint.menu.main.file.js
@@ -0,0 +1,75 @@
+(function ($) {
+ var img = 'plugins/file/img/icons-menu-main-file.png';
+
+ // extend menu
+ $.extend(true, $.fn.wPaint.menus.main.items, {
+ save: {
+ icon: 'generic',
+ title: 'Save Image',
+ img: img,
+ index: 0,
+ callback: function () {
+ this.options.saveImg.apply(this, [this.getImage()]);
+ }
+ },
+ loadBg: {
+ icon: 'generic',
+ group: 'loadImg',
+ title: 'Load Image to Foreground',
+ img: img,
+ index: 2,
+ callback: function () {
+ this.options.loadImgFg.apply(this, []);
+ }
+ },
+ loadFg: {
+ icon: 'generic',
+ group: 'loadImg',
+ title: 'Load Image to Background',
+ img: img,
+ index: 1,
+ callback: function () {
+ this.options.loadImgBg.apply(this, []);
+ }
+ }
+ });
+
+ // extend defaults
+ $.extend($.fn.wPaint.defaults, {
+ saveImg: null, // callback triggerd on image save
+ loadImgFg: null, // callback triggered on image fg
+ loadImgBg: null // callback triggerd on image bg
+ });
+
+ // extend functions
+ $.fn.wPaint.extend({
+ _showFileModal: function (type, images) {
+ var _this = this,
+ $content = $('<div></div>'),
+ $img = null;
+
+ function appendContent(type, image) {
+ function imgClick(e) {
+
+ // just in case to not draw on canvas
+ e.stopPropagation();
+ if (type === 'fg') { _this.setImage(image); }
+ else if (type === 'bg') { _this.setBg(image, null, null, true); }
+ }
+
+ $img.on('click', imgClick);
+ }
+
+ for (var i = 0, ii = images.length; i < ii; i++) {
+ $img = $('<img class="wPaint-modal-img"/>').attr('src', images[i]);
+ $img = $('<div class="wPaint-modal-img-holder"></div>').append($img);
+
+ (appendContent)(type, images[i]);
+
+ $content.append($img);
+ }
+
+ this._showModal($content);
+ }
+ });
+})(jQuery); \ No newline at end of file
diff --git a/static/js/wpaint/plugins/file/wPaint.menu.main.file.min.js b/static/js/wpaint/plugins/file/wPaint.menu.main.file.min.js
new file mode 100644
index 0000000..a2631b7
--- /dev/null
+++ b/static/js/wpaint/plugins/file/wPaint.menu.main.file.min.js
@@ -0,0 +1 @@
+/*! wPaint - v2.5.0 - 2014-03-01 */!function(a){var b="plugins/file/img/icons-menu-main-file.png";a.extend(!0,a.fn.wPaint.menus.main.items,{save:{icon:"generic",title:"Save Image",img:b,index:0,callback:function(){this.options.saveImg.apply(this,[this.getImage()])}},loadBg:{icon:"generic",group:"loadImg",title:"Load Image to Foreground",img:b,index:2,callback:function(){this.options.loadImgFg.apply(this,[])}},loadFg:{icon:"generic",group:"loadImg",title:"Load Image to Background",img:b,index:1,callback:function(){this.options.loadImgBg.apply(this,[])}}}),a.extend(a.fn.wPaint.defaults,{saveImg:null,loadImgFg:null,loadImgBg:null}),a.fn.wPaint.extend({_showFileModal:function(b,c){function d(a,b){function c(c){c.stopPropagation(),"fg"===a?e.setImage(b):"bg"===a&&e.setBg(b,null,null,!0)}g.on("click",c)}for(var e=this,f=a("<div></div>"),g=null,h=0,i=c.length;i>h;h++)g=a('<img class="wPaint-modal-img"/>').attr("src",c[h]),g=a('<div class="wPaint-modal-img-holder"></div>').append(g),d(b,c[h]),f.append(g);this._showModal(f)}})}(jQuery); \ No newline at end of file