// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
-// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt GOL
+// @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL
/**
* Copyright (c) 2014 Leonardo Cardoso (http://leocardz.com)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
var getAttachmentData = function(content) {
var data = {};
- var match = content.match(/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism);
+ var match = content.match(/([\s\S]*)\[attachment([\s\S]*?)\]([\s\S]*?)\[\/attachment\]([\s\S]*)/im);
if (match === null || match.length < 5) {
return null;
}
data.text = trim(match[1]);
var type = '';
- var matches = attributes.match(/type='(.*?)'/ism);
+ var matches = attributes.match(/type='([\s\S]*?)'/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
type = matches[1].toLowerCase();
}
- matches = attributes.match(/type="(.*?)"/ism);
+ matches = attributes.match(/type="([\s\S]*?)"/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
type = matches[1].toLowerCase();
}
var url = '';
- matches = attributes.match(/url='(.*?)'/ism);
+ matches = attributes.match(/url='([\s\S]*?)'/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
url = matches[1].toLowerCase();
}
- matches = attributes.match(/url="(.*?)"/ism);
+ matches = attributes.match(/url="([\s\S]*?)"/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
url = matches[1].toLowerCase();
}
var title = '';
- matches = attributes.match(/title='(.*?)'/ism);
+ matches = attributes.match(/title='([\s\S]*?)'/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
title = matches[1].toLowerCase();
}
- matches = attributes.match(/title="(.*?)"/ism);
+ matches = attributes.match(/title="([\s\S]*?)"/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
title = matches[1].toLowerCase();
}
var image = '';
- matches = attributes.match(/image='(.*?)'/ism);
+ matches = attributes.match(/image='([\s\S]*?)'/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
image = matches[1].toLowerCase();
}
- matches = attributes.match(/image="(.*?)"/ism);
+ matches = attributes.match(/image="([\s\S]*?)"/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
image = matches[1].toLowerCase();
}
var preview = '';
- matches = attributes.match(/preview='(.*?)'/ism);
+ matches = attributes.match(/preview='([\s\S]*?)'/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
preview = matches[1].toLowerCase();
}
- matches = attributes.match(/preview="(.*?)"/ism);
+ matches = attributes.match(/preview="([\s\S]*?)"/im);
if (matches !== null && typeof matches[1] !== 'undefined') {
preview = matches[1].toLowerCase();
}
if (attachmentData) {
reAddAttachment(attachmentData);
// Remove the attachment bbcode from the textarea.
- var content = content.replace(/\[attachment.*\[\/attachment]/ism, '');
+ var content = content.replace(/\[attachment[\s\S]*\[\/attachment]/im, '');
$('#' + selector).val(content);
$('#' + selector).focus();
}