+
+ // move heading from network stream to the second navbar nav-short-info section
+ if( $(".network-content-wrapper > .section-title-wrapper").length) {
+ // get the heading element
+ var heading = $(".network-content-wrapper > .section-title-wrapper > h2");
+ // get the text of the heading
+ var headingContent = heading.text();
+ // create a new element with the content of the heading
+ var newText = '<h4 class="heading" data-toggle="tooltip" title="'+headingContent+'">'+headingContent+'</h4>';
+ // remove the old heading element
+ heading.remove(),
+ // put the new element to the second nav bar
+ $("#topbar-second #nav-short-info").append(newText);
+ }
+
+ if( $(".community-content-wrapper").length) {
+ // get the heading element
+ var heading = $(".community-content-wrapper > h3").first();
+ // get the text of the heading
+ var headingContent = heading.text();
+ // create a new element with the content of the heading
+ var newText = '<h4 class="heading">'+headingContent+'</h4>';
+ // remove the old heading element
+ heading.remove(),
+ // put the new element to the second nav bar
+ $("#topbar-second > .container > #tabmenu").append(newText);
+ }
+
+ // Dropdown menus with the class "dropdown-head" will display the active tab
+ // as button text
+ $("body").on('click', '.dropdown-head .dropdown-menu li a', function(){
+ $(this).closest(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
+ $(this).closest(".dropdown").find('.btn').val($(this).data('value'));
+ $(this).closest("ul").children("li").show();
+ $(this).parent("li").hide();
+ });
+
+ /* setup onoff widgets */
+ // Add the correct class to the switcher according to the input
+ // value (On/Off)
+ $(".toggle input").each(function(){
+ // Get the value of the input element
+ val = $(this).val();
+ id = $(this).attr("id");
+
+ // The css classes for "on" and "off"
+ onstyle = "btn-primary";
+ offstyle = "btn-default off";
+
+ // Add the correct class in dependence of input value (On/Off)
+ toggleclass = (val == 0 ? offstyle : onstyle);
+ $("#"+id+"_onoff").addClass(toggleclass);
+
+ });
+
+ // Change the css class while clicking on the switcher elements
+ $(".toggle label, .toggle .toggle-handle").click(function(event){
+ event.preventDefault();
+ // Get the value of the input element
+ var input = $(this).siblings("input");
+ var val = 1-input.val();
+ var id = input.attr("id");
+
+ // The css classes for "on" and "off"
+ var onstyle = "btn-primary";
+ var offstyle = "btn-default off";
+
+ // According to the value of the input element we need to decide
+ // which class need to be added and removed when changing the switch
+ var removedclass = (val == 0 ? onstyle : offstyle);
+ var addedclass = (val == 0 ? offstyle : onstyle)
+ $("#"+id+"_onoff").addClass(addedclass).removeClass(removedclass);
+
+ // After changing the switch the input element is getting
+ // the newvalue
+ input.val(val);
+ });
+
+ // Set the padding for input elements with inline buttons
+ //
+ // In Frio we use some input elements where the submit button is visually
+ // inside the the input field (through css). We need to set a padding-right
+ // to the input element where the padding value would be at least the width
+ // of the button. Otherwise long user input would be invisible because it is
+ // behind the button.
+ $("body").on('click', '.form-group-search > input', function() {
+ // Get the width of the button (if the button isn't available
+ // buttonWidth will be null
+ var buttonWidth = $(this).next('.form-button-search').outerWidth();
+
+ if (buttonWidth) {
+ // Take the width of the button and ad 5px
+ var newWidth = buttonWidth + 5;
+ // Set the padding of the input element according
+ // to the width of the button
+ $(this).css('padding-right', newWidth);
+ }
+
+ });
+
+