Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
v0.2.14
Browse files Browse the repository at this point in the history
  • Loading branch information
linkesch committed Oct 14, 2014
1 parent 38adae4 commit b5f6a1b
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 98 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medium-editor-insert-plugin",
"version": "0.2.13",
"version": "0.2.14",
"description": "jQuery insert plugin for MediumEditor",
"main": [
"dist/js/medium-editor-insert-plugin.all.js",
Expand Down
2 changes: 1 addition & 1 deletion dist/css/medium-editor-insert-plugin-frontend.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* medium-editor-insert-plugin v0.2.13 - jQuery insert plugin for MediumEditor
* medium-editor-insert-plugin v0.2.14 - jQuery insert plugin for MediumEditor
*
* https://github.com/orthes/medium-editor-insert-plugin
*
Expand Down
2 changes: 1 addition & 1 deletion dist/css/medium-editor-insert-plugin-frontend.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/medium-editor-insert-plugin.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* medium-editor-insert-plugin v0.2.13 - jQuery insert plugin for MediumEditor
* medium-editor-insert-plugin v0.2.14 - jQuery insert plugin for MediumEditor
*
* https://github.com/orthes/medium-editor-insert-plugin
*
Expand Down
2 changes: 1 addition & 1 deletion dist/css/medium-editor-insert-plugin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions dist/js/addons/medium-editor-insert-embeds.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* medium-editor-insert-plugin v0.2.13 - jQuery insert plugin for MediumEditor
* medium-editor-insert-plugin v0.2.14 - jQuery insert plugin for MediumEditor
*
* https://github.com/orthes/medium-editor-insert-plugin
*
Expand All @@ -15,7 +15,7 @@
* Embed default options
*/

default: {
defaults: {
urlPlaceholder: 'Paste or type a link'
//,oembedProxy: 'http://medium.iframe.ly/api/oembed?iframe=1'
},
Expand All @@ -25,20 +25,21 @@
* @return {void}
*/
init : function (options) {
this.options = $.extend(this.default, options);
this.options = $.extend(this.defaults, options);
this.$el = $.fn.mediumInsert.insert.$el;
this.setEmbedButtonEvents();
this.preparePreviousEmbeds();
},

insertButton : function (buttonLabels) {
var label = 'Embed';
if (buttonLabels == 'fontawesome' || typeof buttonLabels === 'object' && !!(buttonLabels.fontawesome)) {
if (buttonLabels === 'fontawesome' || typeof buttonLabels === 'object' && !!(buttonLabels.fontawesome)) {
label = '<i class="fa fa-code"></i>';
}
if (typeof buttonLabels === 'object' && buttonLabels.embed) {
label = buttonLabels.embed;
}

if (typeof buttonLabels === 'object' && buttonLabels.embed) {
label = buttonLabels.embed;
}

return '<button data-addon="embeds" data-action="add" class="medium-editor-action mediumInsert-action">' + label + '</button>';
},
Expand Down Expand Up @@ -80,7 +81,7 @@
setEmbedButtonEvents : function () {
var that = this;
$(document).on('keypress', 'input.mediumInsert-embedsText', function (e) {
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
that.setEnterActionEvents();
that.removeToolbar();
}
Expand Down Expand Up @@ -123,8 +124,8 @@
that.currentPlaceholder.append(embed_tag);
that.currentPlaceholder.closest('[data-medium-element]').trigger('keyup').trigger('input');

if(returnedTag.indexOf("facebook") != -1) {
if (typeof(FB) != 'undefined') {
if(returnedTag.indexOf("facebook") !== -1) {
if (typeof(FB) !== 'undefined') {
setTimeout(function() { FB.XFBML.parse();}, 2000);
}
}
Expand Down Expand Up @@ -164,11 +165,11 @@
cb(null, data, jqXHR);
},
error: function(jqXHR, textStatus, errorThrown) {
var responseJSON = function() {
var responseJSON = (function() {
try {
return JSON.parse(jqXHR.responseText);
} catch(e) {}
}();
}());

cb((responseJSON && responseJSON.error) || jqXHR.status || errorThrown.message, responseJSON, jqXHR);
}
Expand All @@ -179,14 +180,14 @@
// We didn't get something we expect so let's get out of here.
if (!(new RegExp(['youtube', 'yout.be', 'vimeo', 'facebook', 'instagram'].join("|")).test(url))) return false;

var embed_tag = url.replace(/\n?/g, '').replace(/^((http(s)?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/(watch\?v=|v\/)?)([a-zA-Z0-9-_]+)(.*)?$/, '<div class="video"><iframe width="420" height="315" src="//www.youtube.com/embed/$7" frameborder="0" allowfullscreen></iframe></div>')
var embed_tag = url.replace(/\n?/g, '').replace(/^((http(s)?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/(watch\?v=|v\/)?)([a-zA-Z0-9\-_]+)(.*)?$/, '<div class="video"><iframe width="420" height="315" src="//www.youtube.com/embed/$7" frameborder="0" allowfullscreen></iframe></div>')
.replace(/^http:\/\/vimeo\.com(\/.+)?\/([0-9]+)$/, '<iframe src="//player.vimeo.com/video/$2" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>')
//.replace(/^https:\/\/twitter\.com\/(\w+)\/status\/(\d+)\/?$/, '<blockquote class="twitter-tweet" align="center" lang="en"><a href="https://twitter.com/$1/statuses/$2"></a></blockquote><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>')
.replace(/^https:\/\/www\.facebook\.com\/(video.php|photo.php)\?v=(\d+).+$/, '<div class="fb-post" data-href="https://www.facebook.com/photo.php?v=$2"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/photo.php?v=$2">Post</a></div></div>')
.replace(/^http:\/\/instagram\.com\/p\/(.+)\/?$/, '<span class="instagram"><iframe src="//instagram.com/p/$1/embed/" width="612" height="710" frameborder="0" scrolling="no" allowtransparency="true"></iframe></span>');


return /<("[^"]*"|'[^']*'|[^'">])*>/.test(embed_tag) ? embed_tag : false;
return (/<("[^"]*"|'[^']*'|[^'">])*>/).test(embed_tag) ? embed_tag : false;
}

});
Expand Down
4 changes: 2 additions & 2 deletions dist/js/addons/medium-editor-insert-embeds.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions dist/js/addons/medium-editor-insert-images.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* medium-editor-insert-plugin v0.2.13 - jQuery insert plugin for MediumEditor
* medium-editor-insert-plugin v0.2.14 - jQuery insert plugin for MediumEditor
*
* https://github.com/orthes/medium-editor-insert-plugin
*
Expand All @@ -15,7 +15,7 @@
* Images default options
*/

default: {
defaults: {
/**
* Active or inactive image's drag and drop
*/
Expand Down Expand Up @@ -100,7 +100,7 @@
if (options && options.$el) {
this.$el = options.$el;
}
this.options = $.extend(this.default, options);
this.options = $.extend(this.defaults, options);

this.setImageEvents();

Expand All @@ -122,13 +122,13 @@

insertButton: function(buttonLabels){
var label = 'Img';
if (buttonLabels == 'fontawesome' || typeof buttonLabels === 'object' && !!(buttonLabels.fontawesome)) {
if (buttonLabels === 'fontawesome' || typeof buttonLabels === 'object' && !!(buttonLabels.fontawesome)) {
label = '<i class="fa fa-picture-o"></i>';
}

if (typeof buttonLabels === 'object' && buttonLabels.img) {
label = buttonLabels.img;
}
if (typeof buttonLabels === 'object' && buttonLabels.img) {
label = buttonLabels.img;
}

return '<button data-addon="images" data-action="add" class="medium-editor-action mediumInsert-action">'+label+'</button>';
},
Expand Down Expand Up @@ -328,15 +328,15 @@
$(this).parent().mouseleave().mouseleave();

$.fn.mediumInsert.insert.deselect();
that.$el.closest('[data-medium-element]').trigger('keyup').trigger('input');
that.$el.trigger('keyup').trigger('input');
});

this.$el.on('click', '.mediumInsert-imageResizeBigger', function () {
$(this).parent().parent().parent().removeClass('small');
$(this).parent().mouseleave().mouseleave();

$.fn.mediumInsert.insert.deselect();
that.$el.closest('[data-medium-element]').trigger('keyup').trigger('input');
that.$el.trigger('keyup').trigger('input');
});

this.$el.on('click', '.mediumInsert-imageRemove', function () {
Expand All @@ -350,7 +350,8 @@
that.deleteFile(img, that);

$.fn.mediumInsert.insert.deselect();
that.$el.closest('[data-medium-element]').trigger('keyup').trigger('input');

that.$el.trigger('keyup').trigger('input');
});
},

Expand Down Expand Up @@ -423,7 +424,7 @@
dropSuccessful = false;
dropSort = false;

that.$el.closest('[data-medium-element]').trigger('keyup').trigger('input');
that.$el.trigger('keyup').trigger('input');
}
});

Expand Down Expand Up @@ -465,7 +466,7 @@
dropSort = true;
dropSortIndex = null;

that.$el.closest('[data-medium-element]').trigger('keyup').trigger('input');
that.$el.trigger('keyup').trigger('input');
});

this.$el.on('drop', '.mediumInsert', function (e) {
Expand Down
Loading

0 comments on commit b5f6a1b

Please sign in to comment.