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.

126 lines
3.8 KiB

  1. <?php
  2. /*
  3. * Name: cleanzero
  4. * Description: Theme with clean design derived from the zero theme family. Including options to set color schemes, font sizes and resizing of images in posts
  5. * Version:
  6. * Author: Christian Vogeley (https://christian-vogeley.de/profile/christian)
  7. */
  8. function cleanzero_init(&$a) {
  9. $a->theme_info = array(
  10. 'extends' => 'duepuntozero',
  11. );
  12. set_template_engine($a, 'smarty3');
  13. $a->page['htmlhead'] .= <<< EOT
  14. <script>
  15. function insertFormatting(comment,BBcode,id) {
  16. var tmpStr = $("#comment-edit-text-" + id).val();
  17. if(tmpStr == comment) {
  18. tmpStr = "";
  19. $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
  20. $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
  21. openMenu("comment-edit-submit-wrapper-" + id);
  22. $("#comment-edit-text-" + id).val(tmpStr);
  23. }
  24. textarea = document.getElementById("comment-edit-text-" +id);
  25. if (document.selection) {
  26. textarea.focus();
  27. selected = document.selection.createRange();
  28. if (BBcode == "url"){
  29. selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
  30. } else
  31. selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
  32. } else if (textarea.selectionStart || textarea.selectionStart == "0") {
  33. var start = textarea.selectionStart;
  34. var end = textarea.selectionEnd;
  35. if (BBcode == "url"){
  36. textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
  37. } else
  38. textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
  39. }
  40. return true;
  41. }
  42. function cmtBbOpen(comment, id) {
  43. if($(comment).hasClass('comment-edit-text-full')) {
  44. $(".comment-edit-bb-" + id).show();
  45. return true;
  46. }
  47. return false;
  48. }
  49. function cmtBbClose(comment, id) {
  50. // if($(comment).hasClass('comment-edit-text-empty')) {
  51. // $(".comment-edit-bb-" + id).hide();
  52. // return true;
  53. // }
  54. return false;
  55. }
  56. $(document).ready(function() {
  57. $('.group-edit-icon').hover(
  58. function() {
  59. $(this).addClass('icon'); $(this).removeClass('iconspacer');},
  60. function() {
  61. $(this).removeClass('icon'); $(this).addClass('iconspacer');}
  62. );
  63. $('.sidebar-group-element').hover(
  64. function() {
  65. id = $(this).attr('id');
  66. $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
  67. function() {
  68. id = $(this).attr('id');
  69. $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
  70. );
  71. $('.savedsearchdrop').hover(
  72. function() {
  73. $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
  74. function() {
  75. $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
  76. );
  77. $('.savedsearchterm').hover(
  78. function() {
  79. id = $(this).attr('id');
  80. $('#drop-' + id).addClass('icon'); $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
  81. function() {
  82. id = $(this).attr('id');
  83. $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
  84. );
  85. });
  86. </script>
  87. EOT;
  88. // get resize configuration
  89. $resize=false;
  90. $site_resize = get_config('cleanzero', 'resize' );
  91. if(local_user()) $resize = get_pconfig(local_user(), 'cleanzero', 'resize' );
  92. if ($resize===false) $resize=$site_resize;
  93. if ($resize===false) $resize=0;
  94. if (intval($resize) > 0) {
  95. //load jquery.ae.image.resize.js
  96. $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/cleanzero/js/jquery.ae.image.resize.js";
  97. $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
  98. $a->page['htmlhead'] .= '
  99. <script>
  100. $(function() {
  101. $(".wall-item-content img").aeImageResize({height: '.$resize.', width: '.$resize.'});
  102. });
  103. </script>';}
  104. }