Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
8.8 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. <script language="javascript" type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
  2. <script language="javascript" type="text/javascript">
  3. var editor=false;
  4. var textlen = 0;
  5. function initEditor(cb) {
  6. if (editor==false) {
  7. $("#profile-jot-text-loading").show();
  8. tinyMCE.init({
  9. theme : "advanced",
  10. mode : "specific_textareas",
  11. editor_selector: /(profile-jot-text|prvmail-text)/,
  12. plugins : "bbcode,paste,fullscreen,autoresize",
  13. theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
  14. theme_advanced_buttons2 : "",
  15. theme_advanced_buttons3 : "",
  16. theme_advanced_toolbar_location : "top",
  17. theme_advanced_toolbar_align : "center",
  18. theme_advanced_blockformats : "blockquote,code",
  19. //theme_advanced_resizing : true,
  20. //theme_advanced_statusbar_location : "bottom",
  21. paste_text_sticky : true,
  22. entity_encoding : "raw",
  23. add_unload_trigger : false,
  24. remove_linebreaks : false,
  25. force_p_newlines : false,
  26. force_br_newlines : true,
  27. forced_root_block : '',
  28. convert_urls: false,
  29. content_css: "$baseurl/view/custom_tinymce.css",
  30. theme_advanced_path : false,
  31. setup : function(ed) {
  32. //Character count
  33. ed.onKeyUp.add(function(ed, e) {
  34. var txt = tinyMCE.activeEditor.getContent();
  35. textlen = txt.length;
  36. if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
  37. $('#profile-jot-desc').html(ispublic);
  38. }
  39. else {
  40. $('#profile-jot-desc').html('&nbsp;');
  41. }
  42. if(textlen <= 140) {
  43. $('#character-counter').removeClass('red');
  44. $('#character-counter').removeClass('orange');
  45. $('#character-counter').addClass('grey');
  46. }
  47. if((textlen > 140) && (textlen <= 420)) {
  48. $('#character-counter').removeClass('grey');
  49. $('#character-counter').removeClass('red');
  50. $('#character-counter').addClass('orange');
  51. }
  52. if(textlen > 420) {
  53. $('#character-counter').removeClass('grey');
  54. $('#character-counter').removeClass('orange');
  55. $('#character-counter').addClass('red');
  56. }
  57. $('#character-counter').text(textlen);
  58. });
  59. ed.onInit.add(function(ed) {
  60. ed.pasteAsPlainText = true;
  61. $("#profile-jot-text-loading").hide();
  62. $("#profile-jot-submit-wrapper").show();
  63. $("#profile-upload-wrapper").show();
  64. $("#profile-attach-wrapper").show();
  65. $("#profile-link-wrapper").show();
  66. $("#profile-youtube-wrapper").show();
  67. $("#profile-video-wrapper").show();
  68. $("#profile-audio-wrapper").show();
  69. $("#profile-location-wrapper").show();
  70. $("#profile-nolocation-wrapper").show();
  71. $("#profile-title-wrapper").show();
  72. $("#profile-jot-plugin-wrapper").show();
  73. $("#character-counter").show();
  74. if (typeof cb!="undefined") cb();
  75. });
  76. }
  77. });
  78. editor = true;
  79. // setup acl popup
  80. $("a#jot-perms-icon").fancybox({
  81. 'transitionIn' : 'none',
  82. 'transitionOut' : 'none'
  83. });
  84. } else {
  85. if (typeof cb!="undefined") cb();
  86. }
  87. } // initEditor
  88. </script>
  89. <script type="text/javascript" src="js/ajaxupload.js" ></script>
  90. <script>
  91. var ispublic = '$ispublic';
  92. $(document).ready(function() {
  93. /* enable tinymce on focus */
  94. $("#profile-jot-text").focus(function(){
  95. if (editor) return;
  96. $(this).val("");
  97. initEditor();
  98. });
  99. var uploader = new window.AjaxUpload(
  100. 'wall-image-upload',
  101. { action: 'wall_upload/$nickname',
  102. name: 'userfile',
  103. onSubmit: function(file,ext) { $('#profile-rotator').show(); },
  104. onComplete: function(file,response) {
  105. tinyMCE.execCommand('mceInsertRawHTML',false,response);
  106. $('#profile-rotator').hide();
  107. }
  108. }
  109. );
  110. var file_uploader = new window.AjaxUpload(
  111. 'wall-file-upload',
  112. { action: 'wall_attach/$nickname',
  113. name: 'userfile',
  114. onSubmit: function(file,ext) { $('#profile-rotator').show(); },
  115. onComplete: function(file,response) {
  116. tinyMCE.execCommand('mceInsertRawHTML',false,response);
  117. $('#profile-rotator').hide();
  118. }
  119. }
  120. );
  121. $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
  122. var selstr;
  123. $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
  124. selstr = $(this).text();
  125. $('#jot-perms-icon').removeClass('unlock').addClass('lock');
  126. $('#jot-public').hide();
  127. $('.profile-jot-net input').attr('disabled', 'disabled');
  128. });
  129. if(selstr == null) {
  130. $('#jot-perms-icon').removeClass('lock').addClass('unlock');
  131. $('#jot-public').show();
  132. $('.profile-jot-net input').attr('disabled', false);
  133. }
  134. }).trigger('change');
  135. });
  136. function deleteCheckedItems() {
  137. var checkedstr = '';
  138. $('.item-select').each( function() {
  139. if($(this).is(':checked')) {
  140. if(checkedstr.length != 0) {
  141. checkedstr = checkedstr + ',' + $(this).val();
  142. }
  143. else {
  144. checkedstr = $(this).val();
  145. }
  146. }
  147. });
  148. $.post('item', { dropitems: checkedstr }, function(data) {
  149. window.location.reload();
  150. });
  151. }
  152. function jotGetLink() {
  153. reply = prompt("$linkurl");
  154. if(reply && reply.length) {
  155. reply = bin2hex(reply);
  156. $('#profile-rotator').show();
  157. $.get('parse_url?url=' + reply, function(data) {
  158. tinyMCE.execCommand('mceInsertRawHTML',false,data);
  159. $('#profile-rotator').hide();
  160. });
  161. }
  162. }
  163. function jotGetVideo() {
  164. reply = prompt("$utubeurl");
  165. if(reply && reply.length) {
  166. tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
  167. }
  168. }
  169. function jotVideoURL() {
  170. reply = prompt("$vidurl");
  171. if(reply && reply.length) {
  172. tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
  173. }
  174. }
  175. function jotAudioURL() {
  176. reply = prompt("$audurl");
  177. if(reply && reply.length) {
  178. tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
  179. }
  180. }
  181. function jotGetLocation() {
  182. reply = prompt("$whereareu", $('#jot-location').val());
  183. if(reply && reply.length) {
  184. $('#jot-location').val(reply);
  185. }
  186. }
  187. function jotTitle() {
  188. reply = prompt("$title", $('#jot-title').val());
  189. if(reply && reply.length) {
  190. $('#jot-title').val(reply);
  191. }
  192. }
  193. function jotShare(id) {
  194. $('#like-rotator-' + id).show();
  195. $.get('share/' + id, function(data) {
  196. if (!editor) $("#profile-jot-text").val("");
  197. initEditor(function(){
  198. tinyMCE.execCommand('mceInsertRawHTML',false,data);
  199. $('#like-rotator-' + id).hide();
  200. $(window).scrollTop(0);
  201. });
  202. });
  203. }
  204. function linkdropper(event) {
  205. var linkFound = event.dataTransfer.types.contains("text/uri-list");
  206. if(linkFound)
  207. event.preventDefault();
  208. }
  209. function linkdrop(event) {
  210. var reply = event.dataTransfer.getData("text/uri-list");
  211. event.target.textContent = reply;
  212. event.preventDefault();
  213. if(reply && reply.length) {
  214. $('#profile-rotator').show();
  215. $.get('parse_url?url=' + reply, function(data) {
  216. if (!editor) $("#profile-jot-text").val("");
  217. initEditor(function(){
  218. tinyMCE.execCommand('mceInsertRawHTML',false,data);
  219. $('#profile-rotator').hide();
  220. });
  221. });
  222. }
  223. }
  224. function jotClearLocation() {
  225. $('#jot-coord').val('');
  226. $('#profile-nolocation-wrapper').hide();
  227. }
  228. $geotag
  229. </script>