Commit 66596e51c766eb66cc72bca4035a476983d15b81
1 parent
2e0e1b3d
Exists in
remove_sisp_buttons
Refactory theme javascript by adding namespaces and also remove some dead code
Signed-off-by: ArthurJahn <stutrzbecher@gmail.com> Signed-off-by: Dylan Guedes <djmgguedes@gmail.com> Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing
1 changed file
with
250 additions
and
187 deletions
Show diff stats
src/noosfero-spb/noosfero-spb-theme/theme.js
1 | -function alignBlocks(containerIndex){ | ||
2 | - //Needed to save the original reference to jQuery(this) | ||
3 | - jt = jQuery(this); | ||
4 | - longerBlock = 0; | ||
5 | - jt.find(".block-outer").each(function () { | ||
6 | - if(jQuery(this).height() > longerBlock) | ||
7 | - longerBlock = jQuery(this).height(); | ||
8 | - }); | 1 | +/* globals jQuery */ |
2 | + | ||
3 | +// Theme javascript namespace | ||
4 | +var SPBNoosferoTheme = {}; | ||
5 | + | ||
6 | +SPBNoosferoTheme.OrganizationRatings = (function($) { | ||
7 | + | ||
8 | + function set_use_report_content() { | ||
9 | + $('.profile-homepage .organization-average-rating-container .rate-this-organization a').html('Avalie este software'); | ||
10 | + $('.make-report-block .make-report-container .button-bar a span').html('Avalie este software'); | ||
11 | + $('.star-rate-data .star-rate-form.rating-cooldown .button-bar a span').html('Avalie este software'); | ||
12 | + $('.make-report-block .make-report-container .make-report-message').html('Relate sua experiência ou do órgão/empresa com relação ao software.'); | ||
13 | + $('.ratings-list .see-more a.icon-arrow-right-p').html('veja todos os relatos'); | ||
14 | + $('.main-content .star-rate-data .star-rate-form .star-comment-container .button-bar input').attr('value', 'Enviar'); | ||
15 | + $('.main-content .star-rate-data .star-rate-form .star-rate-text').html('Avalie este software'); | ||
16 | + $('.main-content .star-rate-data .star-rate-form .star-comment-container .formlabel').html('Depoimento sobre o software'); | ||
17 | + $('.star-rate-form .star-comment-container .comments-display-fields span#comments-additional-information').html('Dados adicionais (órgãos e empresas)'); | ||
18 | + $('.star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments label').html('Nome do órgão ou empresa'); | ||
19 | + $('.star-rate-form .star-comment-container .comments-software-extra-fields .comments-software-people-benefited label').html('Número de beneficiados'); | ||
20 | + $('.star-rate-form .star-comment-container .comments-software-extra-fields .comments-software-saved-values label').html('Recursos economizados'); | ||
21 | + } | ||
22 | + | ||
23 | + function set_tooltip_content() { | ||
24 | + $('.star-tooltip').html("?"); | ||
25 | + } | ||
9 | 26 | ||
10 | - jt.find("#block-48504 .block-inner-2").height(492); | ||
11 | - jt.find("#block-55304 .block-inner-2").height(378); | ||
12 | - | ||
13 | - //Aligns the blocks in the most common situations | ||
14 | - jt.find(".block-outer").height(longerBlock); | ||
15 | - //Only used for blocks with video, since it uses the size of the iframe | ||
16 | - if(jt.find("iframe").length > 0){ | ||
17 | - jt.find(".block-inner-1 .block-inner-2").each(function (idx) { | ||
18 | - if(idx==2){ | ||
19 | - jQuery(this).height(jt.find("iframe").height()); | ||
20 | - } | ||
21 | - }); | 27 | + function animateExtraFields(additional_fields, arrow) { |
28 | + var innerHeight = additional_fields[0].offsetHeight; | ||
29 | + | ||
30 | + if(additional_fields.height() !== 0) { | ||
31 | + arrow.attr('class', "comments-arrow-down"); | ||
32 | + additional_fields.animate({height: 0}); | ||
33 | + } else { | ||
34 | + arrow.attr('class', "comments-arrow-up"); | ||
35 | + additional_fields.animate({height: additional_fields.get(0).scrollHeight}, 1000 ); | ||
22 | } | 36 | } |
23 | -} | ||
24 | 37 | ||
25 | -(function($) { | ||
26 | - // Run code | ||
27 | - if($.cookie("high_contrast") === 'true'){ | ||
28 | - $( "body" ).toggleClass( "contraste" ); | ||
29 | - } | ||
30 | - $( "#siteaction-contraste a" ).click(function() { | ||
31 | - $( "body" ).toggleClass( "contraste" ); | ||
32 | - if($('body').hasClass('contraste')){ | ||
33 | - $.cookie('high_contrast', 'true', {path: '/'}); | ||
34 | - } else { | ||
35 | - $.cookie('high_contrast', null, { path: '/' }); | ||
36 | - } | ||
37 | - }); | 38 | + // Fix for the arrow change on modal display to block, killing the entire page |
39 | + $("#institution_modal").css({'display':'none'}); | ||
40 | + } | ||
38 | 41 | ||
39 | - $( ".profile-image" ).prepend( "<span class='helper'></span>" ); | ||
40 | - //insere a mensagem no bloco de trilhas na página inicial// | ||
41 | - $( ".action-home-index #content .community-track-plugin_track-card-list-block .track_list" ).prepend( "<span class='msg_block'>Construa seu caminho de participação na elaboração de políticas públicas...</span>" ); | ||
42 | - //insere a mensagem no bloco de comunidades na página inicial// | ||
43 | - $( ".action-home-index #content .communities-block .block-inner-2>div" ).prepend( "<span class='msg_block'>Participe dos dialogos entre governo e sociedade em comunidades temáticas...</span>" ); | ||
44 | - $( ".action-home-index #content .communities-block .block-inner-2>div.block-footer-content .msg_block" ).remove(); | ||
45 | - $('.container-block-plugin_container-block').each(alignBlocks); | 42 | + function set_arrow_direction() { |
43 | + var additional_data_bar = $('.comments-display-fields'); | ||
46 | 44 | ||
47 | - $('#block-48500 > .block-inner-1 > .block-inner-2').append('<div class="more_button" style="position: absolute; top: 5px; left: 519px;"><div class="view_all"><a href="/portal/blog">Ler todas</a></div></div>'); | 45 | + additional_data_bar.on('click', function() { |
46 | + var arrow = additional_data_bar.find('span[class*="comments-arrow"]'); | ||
47 | + var additional_fields = $('.comments-software-extra-fields'); | ||
48 | + | ||
49 | + if (additional_fields) { | ||
50 | + animateExtraFields(additional_fields, arrow); | ||
51 | + } | ||
52 | + }); | ||
53 | + } | ||
48 | 54 | ||
49 | 55 | ||
56 | + function initialize() { | ||
57 | + set_use_report_content(); | ||
58 | + set_tooltip_content(); | ||
59 | + set_arrow_direction(); | ||
60 | + } | ||
50 | 61 | ||
51 | -// Foco no botao de busca | ||
52 | 62 | ||
53 | -$('#link-buscar').click(function(e) { | ||
54 | - e.defaultPrevented(); | ||
55 | - window.location.hash = '#portal-searchbox'; | ||
56 | - $('.searchField').focus() | ||
57 | -}) | 63 | + return { |
64 | + init: initialize | ||
65 | + }; | ||
58 | 66 | ||
59 | -})(jQuery); | 67 | +}) (jQuery); |
60 | 68 | ||
61 | 69 | ||
62 | -// Efeito Fade nos box de softwares | 70 | +SPBNoosferoTheme.NoosferoUserMessages = (function($) { |
71 | + // Places some user mensagens on noosfero | ||
72 | + function user_messages_additions() { | ||
73 | + //insere a mensagem no bloco de trilhas na página inicial// | ||
74 | + $(".action-home-index #content .community-track-plugin_track-card-list-block .track_list").prepend("<span class='msg_block'>Construa seu caminho de participação na elaboração de políticas públicas...</span>"); | ||
75 | + //insere a mensagem no bloco de comunidades na página inicial// | ||
76 | + $(".action-home-index #content .communities-block .block-inner-2>div").prepend("<span class='msg_block'>Participe dos dialogos entre governo e sociedade em comunidades temáticas...</span>"); | ||
77 | + $(".action-home-index #content .communities-block .block-inner-2>div.block-footer-content .msg_block").remove(); | ||
63 | 78 | ||
64 | -(function($){ | ||
65 | - "use strict";// Make javascript less intolerant to errors | 79 | + $('#block-48500 > .block-inner-1 > .block-inner-2').append('<div class="more_button" style="position: absolute; top: 5px; left: 519px;"><div class="view_all"><a href="/portal/blog">Ler todas</a></div></div>'); |
80 | + } | ||
66 | 81 | ||
67 | - var TRANSITION_TIME = 250;// milliseconds | ||
68 | 82 | ||
83 | + function initialize() { | ||
84 | + user_messages_additions(); | ||
85 | + } | ||
69 | 86 | ||
70 | - function show_finality() { | ||
71 | - var finality = $(this).children(".software-block-finality"); | 87 | + return { |
88 | + init: initialize | ||
89 | + }; | ||
72 | 90 | ||
73 | - //finality.stop().fadeTo(TRANSITION_TIME,1); | ||
74 | - finality.stop().fadeTo('fast', 1); | ||
75 | - //finality.stop().animate({"top" : "0%"}, TRANSITION_TIME); | 91 | +}) (jQuery); |
92 | + | ||
93 | + | ||
94 | +// Fade effect on software blocks in the portal homepage | ||
95 | +SPBNoosferoTheme.HighlightedSoftwaresBlock = (function($) { | ||
96 | + "use strict"; | ||
97 | + | ||
98 | + function show_finality(evt) { | ||
99 | + var $finality = $(this).children(".software-block-finality"); | ||
100 | + | ||
101 | + $finality.stop().fadeTo('fast', 1); | ||
76 | } | 102 | } |
77 | 103 | ||
104 | + | ||
78 | function hide_finality() { | 105 | function hide_finality() { |
79 | - var finality = $(this).children(".software-block-finality"); | 106 | + var $finality = $(this).children(".software-block-finality"); |
80 | 107 | ||
81 | - //finality.stop().fadeTo(TRANSITION_TIME,0); | ||
82 | - finality.stop().fadeTo('fast', 0); | ||
83 | - //finality.stop().animate({"top" : "100%"}, TRANSITION_TIME); | 108 | + $finality.stop().fadeTo('fast', 0); |
84 | } | 109 | } |
85 | 110 | ||
86 | - function move_article_buttons(){ | ||
87 | - var article_actions = $('#article-actions').clone(); | ||
88 | - var report = $('.report-abuse-action').remove(); | ||
89 | - var suggest = $('.icon-suggest').remove(); | ||
90 | 111 | ||
112 | + function set_events(){ | ||
113 | + // Fade css | ||
114 | + var $softwares_finality_blocks = $('.software-block-finality'); | ||
115 | + $softwares_finality_blocks.css({'opacity':0, 'top':0}); | ||
91 | 116 | ||
92 | - $(article_actions).find('.icon-edit, .icon-new, .icon-delete, .icon-locale').remove(); | ||
93 | - $('.article-body').append(article_actions); | 117 | + // End Fade CSS |
118 | + var $softwares_blocks = $('.software-block'); | ||
119 | + $softwares_blocks.mouseover(show_finality); | ||
120 | + $softwares_blocks.mouseout(hide_finality); | ||
121 | + } | ||
122 | + | ||
123 | + | ||
124 | + function initialize() { | ||
125 | + if ($("#box-1 .softwares-block").length === 1) { | ||
126 | + set_events(); | ||
127 | + } | ||
94 | } | 128 | } |
95 | 129 | ||
130 | + return { | ||
131 | + init: initialize | ||
132 | + }; | ||
133 | +}) (jQuery); | ||
134 | + | ||
135 | + | ||
136 | +SPBNoosferoTheme.NoosferoHTMLAditions = (function($) { | ||
137 | + "use strict"; | ||
138 | + | ||
96 | function add_link_to_article_div(){ | 139 | function add_link_to_article_div(){ |
97 | var list = $('.display-content-block').find('li'); | 140 | var list = $('.display-content-block').find('li'); |
98 | 141 | ||
@@ -108,27 +151,120 @@ $('#link-buscar').click(function(e) { | @@ -108,27 +151,120 @@ $('#link-buscar').click(function(e) { | ||
108 | }); | 151 | }); |
109 | } | 152 | } |
110 | 153 | ||
154 | + | ||
111 | function insert_notice_div(){ | 155 | function insert_notice_div(){ |
112 | var notice = $('.display-content-block').find('li'); | 156 | var notice = $('.display-content-block').find('li'); |
113 | - notice.each(function(){ | ||
114 | - var $set = $(this).children(); | ||
115 | - for(var i=1, len = $set.length; i < len; i+=5){ | 157 | + |
158 | + notice.each(function() { | ||
159 | + var i, len, $set = $(this).children(); | ||
160 | + | ||
161 | + for(i=1, len = $set.length; i < len; i+=5){ | ||
116 | $set.slice(i, i+5).wrapAll('<div class="notice-item"/>'); | 162 | $set.slice(i, i+5).wrapAll('<div class="notice-item"/>'); |
117 | } | 163 | } |
118 | - for(var i=2, len = $set.length; i < len; i+=3){ | 164 | + |
165 | + for(i=2, len = $set.length; i < len; i+=3){ | ||
119 | $set.slice(i, i+3).wrapAll('<div class="notice-info"/>'); | 166 | $set.slice(i, i+3).wrapAll('<div class="notice-info"/>'); |
120 | } | 167 | } |
121 | - //$('<div class="notice-item"></div>').wrap($(this).find( '.image', '.title', '.lead', '.read_more')); | ||
122 | }); | 168 | }); |
169 | + } | ||
123 | 170 | ||
171 | + | ||
172 | + function add_tooltips(){ | ||
173 | + $('#content span[title]').attr("data-toggle","tooltip"); | ||
174 | + | ||
175 | + $('[data-toggle="tooltip"]').tooltip(); | ||
124 | } | 176 | } |
125 | 177 | ||
178 | + | ||
179 | + function add_popovers() { | ||
180 | + var span = $('span[data-toggle="popover"]'); | ||
181 | + var place = span.attr("data-placement"); | ||
182 | + var elementClass = span.attr("data-class"); | ||
183 | + | ||
184 | + var popover = span.popover({ | ||
185 | + html:true, | ||
186 | + placement: place, | ||
187 | + content: function() { | ||
188 | + return $(this).next().html(); | ||
189 | + } | ||
190 | + }) | ||
191 | + .data('bs.popover'); | ||
192 | + | ||
193 | + if(popover) { | ||
194 | + popover.tip() | ||
195 | + .addClass(elementClass); | ||
196 | + $('a.toggle-popover').on("click",function() { | ||
197 | + span.trigger("click"); | ||
198 | + }); | ||
199 | + } | ||
200 | + } | ||
201 | + | ||
202 | + function move_breadcrumbs() { | ||
203 | + $('.breadcrumbs-plugin_content-breadcrumbs-block').prependTo('#wrap-2'); | ||
204 | + $('<span id="breadcrumbs-you-are-here">Você está aqui:</span>').insertBefore($('.breadcrumbs-plugin_content-breadcrumbs-block .block-inner-2').children().first()); | ||
205 | + } | ||
206 | + | ||
207 | + // temporary solution for the suspension_point in some buttons | ||
208 | + function remove_suspension_points_in_buttons() { | ||
209 | + $(".template-kind a span:contains('...')").each(function(index, element) { | ||
210 | + element.innerHTML = element.innerHTML.replace(/(\...)/, ""); | ||
211 | + }); | ||
212 | + } | ||
213 | + | ||
214 | + // temporary solution for the text in send_email buttons | ||
215 | + function replace_send_email_button_text() { | ||
216 | + $('.action-profile-members .page-members-header .icon-menu-mail').html('Contatar administradores'); | ||
217 | + } | ||
218 | + | ||
219 | + | ||
220 | + // Put the focus on the search form when user click on the "go to search link" | ||
221 | + function search_link_apply_focus_to_its_form() { | ||
222 | + $('#link-buscar').click(function(e) { | ||
223 | + e.preventDefault(); | ||
224 | + $('.searchField').focus(); | ||
225 | + }); | ||
226 | + } | ||
227 | + | ||
228 | + | ||
229 | + function move_article_buttons(){ | ||
230 | + var article_actions = $('#article-actions').clone(); | ||
231 | + var report = $('.report-abuse-action').remove(); | ||
232 | + var suggest = $('.icon-suggest').remove(); | ||
233 | + | ||
234 | + $(article_actions).find('.icon-edit, .icon-new, .icon-delete, .icon-locale').remove(); | ||
235 | + $('.article-body').append(article_actions); | ||
236 | + } | ||
237 | + | ||
238 | + | ||
239 | + function initialize() { | ||
240 | + add_link_to_article_div(); | ||
241 | + insert_notice_div(); | ||
242 | + add_tooltips(); | ||
243 | + add_popovers(); | ||
244 | + move_breadcrumbs(); | ||
245 | + remove_suspension_points_in_buttons(); | ||
246 | + replace_send_email_button_text(); | ||
247 | + search_link_apply_focus_to_its_form(); | ||
248 | + move_article_buttons(); | ||
249 | + } | ||
250 | + | ||
251 | + return { | ||
252 | + init: initialize | ||
253 | + }; | ||
254 | + | ||
255 | +}) (jQuery); | ||
256 | + | ||
257 | + | ||
258 | +SPBNoosferoTheme.SoftwareCatalog = (function($) { | ||
259 | + "use strict"; | ||
260 | + | ||
126 | //toggle filter options in catalog page | 261 | //toggle filter options in catalog page |
127 | function setFilterCategoriesOptionClass() { | 262 | function setFilterCategoriesOptionClass() { |
128 | var filterOptions = $("#filter-categories-option"); | 263 | var filterOptions = $("#filter-categories-option"); |
129 | filterOptions.addClass("animated slideInDown"); | 264 | filterOptions.addClass("animated slideInDown"); |
130 | } | 265 | } |
131 | 266 | ||
267 | + | ||
132 | function toggleFilterOptions(){ | 268 | function toggleFilterOptions(){ |
133 | var filterOptions = $("#filter-categories-option"); | 269 | var filterOptions = $("#filter-categories-option"); |
134 | var filterHeight = filterOptions[0].scrollHeight; | 270 | var filterHeight = filterOptions[0].scrollHeight; |
@@ -152,34 +288,28 @@ $('#link-buscar').click(function(e) { | @@ -152,34 +288,28 @@ $('#link-buscar').click(function(e) { | ||
152 | } | 288 | } |
153 | } | 289 | } |
154 | 290 | ||
155 | - function setEvents(){ | ||
156 | - // Fade css | ||
157 | - $('.software-block-finality').css({'opacity':0, 'top':0}); | ||
158 | - // End Fade CSS | ||
159 | - var software_block = $('.software-block'); | ||
160 | - software_block.mouseover(show_finality); | ||
161 | - software_block.mouseout(hide_finality); | ||
162 | 291 | ||
292 | + function setEvents() { | ||
163 | var showOptions = $("#filter-option-catalog-software"); | 293 | var showOptions = $("#filter-option-catalog-software"); |
164 | var hideOptions = $("#filter-option-catalog-close"); | 294 | var hideOptions = $("#filter-option-catalog-close"); |
295 | + | ||
165 | showOptions.click(toggleFilterOptions); | 296 | showOptions.click(toggleFilterOptions); |
166 | hideOptions.click(toggleFilterOptions); | 297 | hideOptions.click(toggleFilterOptions); |
167 | } | 298 | } |
168 | 299 | ||
169 | - /* Finds all uploaded files from manuals page and sets its names on the right format */ | ||
170 | - function set_uploaded_files_names() { | ||
171 | - try { | ||
172 | - var article = document.getElementById('article'); | ||
173 | - var folderList = article.getElementsByClassName('folder-content')[0]; | ||
174 | - var folderItens = folderList.getElementsByClassName('item-description'); | 300 | + function initialize() { |
301 | + setFilterCategoriesOptionClass(); | ||
302 | + setEvents(); | ||
303 | + } | ||
175 | 304 | ||
176 | - for(var i = 0, var loop_length = folderItens.length; i < loop_length; i++) { | ||
177 | - split_file_extension(folderItens[i].getElementsByTagName('a')[0]); | ||
178 | - } | ||
179 | - } catch(e) { | 305 | + return { |
306 | + init: initialize | ||
307 | + }; | ||
308 | +}) (jQuery); | ||
180 | 309 | ||
181 | - } | ||
182 | - } | 310 | + |
311 | +SPBNoosferoTheme.NoosferoFoldersContent = (function($) { | ||
312 | + "use strict"; | ||
183 | 313 | ||
184 | /* Splits a file name from its extension. Example: example.pdf becomes example - PDF */ | 314 | /* Splits a file name from its extension. Example: example.pdf becomes example - PDF */ |
185 | function split_file_extension(element) { | 315 | function split_file_extension(element) { |
@@ -191,113 +321,46 @@ $('#link-buscar').click(function(e) { | @@ -191,113 +321,46 @@ $('#link-buscar').click(function(e) { | ||
191 | } | 321 | } |
192 | } | 322 | } |
193 | 323 | ||
194 | - function set_tooltip_content() { | ||
195 | - $('.star-tooltip').html("?"); | ||
196 | - } | ||
197 | - | ||
198 | - function set_arrow_direction() { | ||
199 | - var additional_data_bar = $('.comments-display-fields'); | ||
200 | 324 | ||
201 | - additional_data_bar.on('click', function() { | ||
202 | - var arrow = additional_data_bar.find('span[class*="comments-arrow"]'); | ||
203 | - var additional_fields = $('.comments-software-extra-fields'); | 325 | + /* Finds all uploaded files from manuals page and sets its names on the right format */ |
326 | + function set_uploaded_files_names() { | ||
327 | + try { | ||
328 | + var article = document.getElementById('article'); | ||
329 | + var folderList = article.getElementsByClassName('folder-content')[0]; | ||
330 | + var folderItens = folderList.getElementsByClassName('item-description'); | ||
204 | 331 | ||
205 | - if (additional_fields) { | ||
206 | - animateExtraFields(additional_fields, arrow); | 332 | + for(var i = 0, loop_length = folderItens.length; i < loop_length; i++) { |
333 | + split_file_extension(folderItens[i].getElementsByTagName('a')[0]); | ||
207 | } | 334 | } |
208 | - }); | ||
209 | - } | ||
210 | - | ||
211 | - | ||
212 | - function animateExtraFields(additional_fields, arrow) { | ||
213 | - var innerHeight = additional_fields[0].offsetHeight; | 335 | + } catch(e) { |
214 | 336 | ||
215 | - if(additional_fields.height() !== 0) { | ||
216 | - arrow.attr('class', "comments-arrow-down"); | ||
217 | - additional_fields.animate({height: 0}); | ||
218 | - } else { | ||
219 | - arrow.attr('class', "comments-arrow-up"); | ||
220 | - additional_fields.animate({height: additional_fields.get(0).scrollHeight}, 1000 ); | ||
221 | } | 337 | } |
222 | - | ||
223 | - // Fix for the arrow change on modal display to block, killing the entire page | ||
224 | - $("#institution_modal").css({'display':'none'}); | ||
225 | } | 338 | } |
226 | 339 | ||
227 | 340 | ||
228 | - function set_use_report_content() { | ||
229 | - $('.profile-homepage .organization-average-rating-container .rate-this-organization a').html('Avalie este software'); | ||
230 | - $('.make-report-block .make-report-container .button-bar a span').html('Avalie este software'); | ||
231 | - $('.star-rate-data .star-rate-form.rating-cooldown .button-bar a span').html('Avalie este software'); | ||
232 | - $('.make-report-block .make-report-container .make-report-message').html('Relate sua experiência ou do órgão/empresa com relação ao software.'); | ||
233 | - $('.ratings-list .see-more a.icon-arrow-right-p').html('veja todos os relatos'); | ||
234 | - $('.main-content .star-rate-data .star-rate-form .star-comment-container .button-bar input').attr('value', 'Enviar'); | ||
235 | - $('.main-content .star-rate-data .star-rate-form .star-rate-text').html('Avalie este software'); | ||
236 | - $('.main-content .star-rate-data .star-rate-form .star-comment-container .formlabel').html('Depoimento sobre o software'); | ||
237 | - $('.star-rate-form .star-comment-container .comments-display-fields span#comments-additional-information').html('Dados adicionais (órgãos e empresas)'); | ||
238 | - $('.star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments label').html('Nome do órgão ou empresa'); | ||
239 | - $('.star-rate-form .star-comment-container .comments-software-extra-fields .comments-software-people-benefited label').html('Número de beneficiados'); | ||
240 | - $('.star-rate-form .star-comment-container .comments-software-extra-fields .comments-software-saved-values label').html('Recursos economizados'); | 341 | + function initialize() { |
342 | + set_uploaded_files_names(); | ||
241 | } | 343 | } |
242 | 344 | ||
243 | - function add_tooltips(){ | ||
244 | - $('#content span[title]').attr("data-toggle","tooltip"); | ||
245 | 345 | ||
246 | - $('[data-toggle="tooltip"]').tooltip(); | ||
247 | - } | ||
248 | - | ||
249 | - function add_popovers() { | ||
250 | - var span = $('span[data-toggle="popover"]'); | ||
251 | - var place = span.attr("data-placement"); | ||
252 | - var elementClass = span.attr("data-class"); | ||
253 | - if(span){ | ||
254 | - var popover = span.popover({ | ||
255 | - html:true, | ||
256 | - placement: place, | ||
257 | - content: function() { | ||
258 | - return $(this).next().html(); | ||
259 | - } | ||
260 | - }) | ||
261 | - .data('bs.popover'); | ||
262 | - } | ||
263 | - if(popover) { | ||
264 | - popover.tip() | ||
265 | - .addClass(elementClass); | ||
266 | - $('a.toggle-popover').on("click",function() { | ||
267 | - span.trigger("click"); | ||
268 | - }); | ||
269 | - } | ||
270 | - } | 346 | + return { |
347 | + init: initialize | ||
348 | + }; | ||
271 | 349 | ||
272 | - function move_breadcrumbs() { | ||
273 | - $('.breadcrumbs-plugin_content-breadcrumbs-block').prependTo('#wrap-2'); | ||
274 | - $('<span id="breadcrumbs-you-are-here">Você está aqui:</span>').insertBefore($('.breadcrumbs-plugin_content-breadcrumbs-block .block-inner-2').children().first()); | ||
275 | - } | 350 | +}) (jQuery); |
276 | 351 | ||
277 | - // temporary solution for the suspension_point in some buttons | ||
278 | - function remove_suspension_points_in_buttons() { | ||
279 | - $(".template-kind a span:contains('...')").each(function(index, element) { | ||
280 | - element.innerHTML = element.innerHTML.replace(/(\...)/, ""); | ||
281 | - }); | ||
282 | - } | ||
283 | 352 | ||
284 | - // temporary solution for the text in send_email buttons | ||
285 | - function replace_send_email_button_text() { | ||
286 | - $('.action-profile-members .page-members-header .icon-menu-mail').html('Contatar administradores'); | ||
287 | - } | 353 | +// Theme javascript bootstrap |
354 | +(function(jQuery) { | ||
355 | + "use strict"; | ||
288 | 356 | ||
289 | - $(document).ready(function(){ | ||
290 | - add_tooltips(); | ||
291 | - add_popovers(); | ||
292 | - move_article_buttons(); | ||
293 | - move_breadcrumbs(); | ||
294 | - insert_notice_div(); | ||
295 | - set_uploaded_files_names(); | ||
296 | - set_tooltip_content(); | ||
297 | - set_arrow_direction(); | ||
298 | - set_use_report_content(); | ||
299 | - setEvents(); | ||
300 | - remove_suspension_points_in_buttons(); | ||
301 | - replace_send_email_button_text(); | ||
302 | - }); | ||
303 | -})(jQuery); | 357 | + // Initialize everything |
358 | + $(document).ready(function() { | ||
359 | + SPBNoosferoTheme.OrganizationRatings.init(); | ||
360 | + SPBNoosferoTheme.NoosferoUserMessages.init(); | ||
361 | + SPBNoosferoTheme.HighlightedSoftwaresBlock.init(); | ||
362 | + SPBNoosferoTheme.NoosferoHTMLAditions.init(); | ||
363 | + SPBNoosferoTheme.SoftwareCatalog.init(); | ||
364 | + SPBNoosferoTheme.NoosferoFoldersContent.init(); | ||
365 | + }); | ||
366 | +}) (jQuery); |