Merge branch 'dev-life' into dev

Conflicts:
	app/init.go
	app/service/UserService.go
	conf/app.conf
	conf/routes
	mongodb_backup/leanote_install_data/albums.metadata.json
	mongodb_backup/leanote_install_data/attachs.metadata.json
	mongodb_backup/leanote_install_data/blog_comments.metadata.json
	mongodb_backup/leanote_install_data/blog_likes.metadata.json
	mongodb_backup/leanote_install_data/blog_singles.metadata.json
	mongodb_backup/leanote_install_data/configs.bson
	mongodb_backup/leanote_install_data/configs.metadata.json
	mongodb_backup/leanote_install_data/email_logs.metadata.json
	mongodb_backup/leanote_install_data/files.metadata.json
	mongodb_backup/leanote_install_data/find_pwds.metadata.json
	mongodb_backup/leanote_install_data/group_users.metadata.json
	mongodb_backup/leanote_install_data/groups.metadata.json
	mongodb_backup/leanote_install_data/has_share_notes.metadata.json
	mongodb_backup/leanote_install_data/leanote.ShareNotes.metadata.json

mongodb_backup/leanote_install_data/leanote.has_share_notes.metadata.jso
n

mongodb_backup/leanote_install_data/note_content_histories.metadata.json
	mongodb_backup/leanote_install_data/note_contents.metadata.json
	mongodb_backup/leanote_install_data/note_images.metadata.json
	mongodb_backup/leanote_install_data/notebooks.bson
	mongodb_backup/leanote_install_data/notebooks.metadata.json
	mongodb_backup/leanote_install_data/notes.bson
	mongodb_backup/leanote_install_data/notes.metadata.json
	mongodb_backup/leanote_install_data/reports.metadata.json
	mongodb_backup/leanote_install_data/sessions.metadata.json
	mongodb_backup/leanote_install_data/share_notebooks.metadata.json
	mongodb_backup/leanote_install_data/share_notes.metadata.json
	mongodb_backup/leanote_install_data/suggestions.metadata.json
	mongodb_backup/leanote_install_data/system.indexes.bson
	mongodb_backup/leanote_install_data/tag_count.metadata.json
	mongodb_backup/leanote_install_data/tags.metadata.json
	mongodb_backup/leanote_install_data/themes.metadata.json
	mongodb_backup/leanote_install_data/tokens.metadata.json
	mongodb_backup/leanote_install_data/user_blogs.metadata.json
	mongodb_backup/leanote_install_data/users.bson
	mongodb_backup/leanote_install_data/users.metadata.json
	public/blog/themes/default/theme.json
	public/blog/themes/elegant/theme.json
	public/blog/themes/nav_fixed/theme.json
	public/images/logo/leanote_icon_blue.jpg
	public/js/app/note-min.js
	public/js/app/note.js
	public/js/app/notebook-min.js
	public/js/app/notebook.js
	public/js/app/tag-min.js
	public/js/app/tag.js
	public/tinymce/plugins/paste/plugin.dev.js
	public/tinymce/plugins/spellchecker/plugin.min.js
	public/tinymce/tinymce.dev.js
	public/tinymce/tinymce.jquery.dev.js
This commit is contained in:
life
2015-03-31 16:18:22 +08:00
510 changed files with 7769 additions and 2623 deletions

View File

@ -1,230 +0,0 @@
// for editor.
// drag image to editor
// Copyright leaui
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
define('leaui_image', ['jquery.ui.widget', 'fileupload'], function(){
// 当url改变时, 得到图片的大小
function getImageSize(url, callback) {
var img = document.createElement('img');
function done(width, height) {
img.parentNode.removeChild(img);
callback({width: width, height: height});
}
img.onload = function() {
done(img.clientWidth, img.clientHeight);
};
img.onerror = function() {
done();
};
img.src = url;
var style = img.style;
style.visibility = 'hidden';
style.position = 'fixed';
style.bottom = style.left = 0;
style.width = style.height = 'auto';
document.body.appendChild(img);
}
var i = 1;
function insertImage(data) {
var editor = tinymce.activeEditor;
var dom = editor.dom;
var renderImage = function(data2) {
// 这里, 如果图片宽度过大, 这里设置成500px
var d = {};
var imgElm;
// 先显示loading...
d.id = '__mcenew' + (i++);
d.src = "http://leanote.com/images/loading-24.gif";
imgElm = dom.createHTML('img', d);
tinymce.activeEditor.insertContent(imgElm);
imgElm = dom.get(d.id);
function callback (wh) {
if(wh && wh.width) {
if(wh.width > 600) {
wh.width = 600;
}
data2.width = wh.width;
}
dom.setAttrib(imgElm, 'src', data2.src);
dom.setAttrib(imgElm, 'width', data2.width);
if(data2.title) {
dom.setAttrib(imgElm, 'title', data2.title);
}
dom.setAttrib(imgElm, 'id', null);
};
getImageSize(data.src, callback);
}
//-------------
// outputImage?fileId=123232323
var fileId = "";
fileIds = data.src.split("fileId=")
if(fileIds.length == 2 && fileIds[1].length == "53aecf8a8a039a43c8036282".length) {
fileId = fileIds[1];
}
if(fileId) {
// 得到fileId, 如果这个笔记不是我的, 那么肯定是协作的笔记, 那么需要将图片copy给原note owner
var curNote = Note.getCurNote();
if(curNote && curNote.UserId != UserInfo.UserId) {
(function(data) {
ajaxPost("/file/copyImage", {userId: UserInfo.UserId, fileId: fileId, toUserId: curNote.UserId}, function(re) {
if(reIsOk(re) && re.Id) {
var urlPrefix = window.location.protocol + "//" + window.location.host;
data.src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
}
renderImage(data);
});
})(data);
} else {
renderImage(data);
}
} else {
renderImage(data);
}
}
var initUploader = function() {
var ul = $('#upload ul');
$('#drop a').click(function() {
// trigger to show file select
$(this).parent().find('input').click();
});
// Initialize the jQuery File Upload plugin
$('#upload').fileupload({
dataType: 'json',
acceptFileTypes: /(\.|\/)(gif|jpg|jpeg|png|jpe)$/i,
maxFileSize: 210000,
// This element will accept file drag/drop uploading
dropZone: $('#drop'),
formData: function(form) {
return [{name: 'albumId', value: ""}]
},
// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function(e, data) {
var tpl = $('<li><div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div></li>');
// Append the file name and file size
tpl.find('div').append(data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small>');
// Add the HTML to the UL element
data.context = tpl.appendTo(ul);
// data.form[0].action += "&album_id=" + $("#albumsForUpload").val();
// Automatically upload the file once it is added to the queue
var jqXHR = data.submit();
},
done: function(e, data) {
if (data.result.Ok == true) {
data.context.remove();
// life
var data2 = {src: urlPrefix + "/file/outputImage?fileId=" + data.result.Id}
insertImage(data2);
} else {
data.context.empty();
var tpl = $('<li><div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div></li>');
tpl.find('div').append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.result.Msg);
data.context.append(tpl);
setTimeout((function(tpl) {
return function() {
tpl.remove();
}
})(tpl), 2000);
}
$("#uploadMsg").scrollTop(1000);
},
fail: function(e, data) {
data.context.empty();
var tpl = $('<li><div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div></li>');
tpl.find('div').append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.errorThrown);
data.context.append(tpl);
setTimeout((function(tpl) {
return function() {
tpl.remove();
}
})(tpl), 2000);
$("#uploadMsg").scrollTop(1000);
}
});
// Prevent the default action when a file is dropped on the window
$(document).on('drop dragover', function(e) {
e.preventDefault();
});
// Helper function that formats the file sizes
function formatFileSize(bytes) {
if (typeof bytes !== 'number') {
return '';
}
if (bytes >= 1000000000) {
return (bytes / 1000000000).toFixed(2) + ' GB';
}
if (bytes >= 1000000) {
return (bytes / 1000000).toFixed(2) + ' MB';
}
return (bytes / 1000).toFixed(2) + ' KB';
}
function showUpload() {
$("#upload").css("z-index", 12);
var top = +$("#mceToolbar").css("height").slice(0, -2); // px
$("#upload").css("top", top - 8);
$("#upload").show();
}
function hideUpload() {
$("#upload").css("z-index", 0).css("top", "auto").hide();
}
// drag css
$(document).bind('dragover', function (e) {
var dropZone = $('#drop'),
timeout = window.dropZoneTimeout;
if (!timeout) {
dropZone.addClass('in');
showUpload();
} else {
clearTimeout(timeout);
}
var found = false,
node = e.target;
do {
if (node === dropZone[0]) {
found = true;
break;
}
node = node.parentNode;
} while (node != null);
if (found) {
dropZone.addClass('hover');
} else {
dropZone.removeClass('hover');
}
window.dropZoneTimeout = setTimeout(function () {
window.dropZoneTimeout = null;
dropZone.removeClass('in hover');
hideUpload();
}, 100);
});
}
initUploader();
});

View File

@ -117,4 +117,8 @@
writeScripts();
})(this);
// $hash: 81dccd126cf777c058d698320fb736ed
<<<<<<< HEAD
// $hash: 81dccd126cf777c058d698320fb736ed
=======
// $hash: eead586884e827fb28480c335ab9d3fc
>>>>>>> dev-life

View File

@ -114,4 +114,4 @@
writeScripts();
})(this);
// $hash: 0dea0ce031907f908bd45feb13483a36
// $hash: 69eeaf44413967796526c27a57f9e5c3

File diff suppressed because one or more lines are too long

View File

@ -116,4 +116,4 @@
writeScripts();
})(this);
// $hash: 03d011b56beb69dc9e64484e888e2704
// $hash: cc4206b9f467adfd42760ee5a6c3606f

View File

@ -1831,7 +1831,7 @@ define("tinymce/tableplugin/Plugin", [
function insertTable(cols, rows) {
var y, x, html;
html = '<table><tbody>';
html = '<table style="width: 100%"><tbody>';
for (y = 0; y < rows; y++) {
html += '<tr>';

File diff suppressed because one or more lines are too long