MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Dokumentation
Wechseln zu:Navigation, Suche
(Die Seite wurde neu angelegt: „→‎Das folgende JavaScript wird für alle Benutzer geladen.: $(document).ready( function() { $('#tree').bind('fancytreeinit', function(event, data) {…“)
 
 
(10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
/* Das folgende JavaScript wird für alle Benutzer geladen. */
+
$.fn.extend({
$(document).ready( function() {
+
    treed: function (o) {
    $('#tree').bind('fancytreeinit', function(event, data) {
+
 
         data.tree.makeTitleVisible();
+
      var openedClass = 'fa-minus-circle';
     });
+
      var closedClass = 'fa-plus-circle';
 +
 
 +
      if (typeof o != 'undefined'){
 +
        if (typeof o.openedClass != 'undefined'){
 +
        openedClass = o.openedClass;
 +
        }
 +
        if (typeof o.closedClass != 'undefined'){
 +
        closedClass = o.closedClass;
 +
        }
 +
      };
 +
 
 +
        //initialize each of the top levels
 +
        var tree = $(this);
 +
        tree.addClass("tree");
 +
        tree.find('li').has("ul").each(function () {
 +
            var branch = $(this); //li with children ul
 +
            branch.prepend("");
 +
            branch.addClass('branch');
 +
            branch.on('click', function (e) {
 +
                if (this == e.target) {
 +
                    var icon = $(this).children('i:first');
 +
                    icon.toggleClass(openedClass + " " + closedClass);
 +
                    $(this).children().children().toggle();
 +
                }
 +
            })
 +
            branch.children().children().toggle();
 +
        });
 +
        //fire event from the dynamically added icon
 +
      tree.find('.branch .indicator').each(function(){
 +
        $(this).on('click', function () {
 +
            $(this).closest('li').click();
 +
        });
 +
      });
 +
        //fire event to open branch if the li contains an anchor instead of text
 +
        tree.find('.branch>a').each(function () {
 +
            $(this).on('click', function (e) {
 +
                $(this).closest('li').click();
 +
                e.preventDefault();
 +
            });
 +
        });
 +
        //fire event to open branch if the li contains a button instead of text
 +
        tree.find('.branch>button').each(function () {
 +
            $(this).on('click', function (e) {
 +
                $(this).closest('li').click();
 +
                e.preventDefault();
 +
            });
 +
         });
 +
    }
 +
});
 +
 
 +
//Initialization of treeviews
 +
 
 +
$('#tree1').treed();
 +
 
 +
$('#tree2').treed({openedClass:'fa-folder-open', closedClass:'fa-folder'});
 +
 
 +
 
 +
$('#tree').treeview({
 +
    data: tree,
 +
    levels: 5,
 +
    backColor: 'white',
 +
    expandIcon: "glyphicon glyphicon-triangle-right",
 +
    collapseIcon: "glyphicon glyphicon-triangle-bottom",
 +
    showBorder: false,
 +
    enableLinks: true
 +
});
 +
      var tree = [
 +
     {
 +
        text: "Assets",
 +
        href: "http://localhost:63690/asset/index",
 +
        nodes: [
 +
        {
 +
            text: "Barcode"
 +
        },
 +
        {
 +
            text: "Importation"
 +
        }
 +
        ]
 +
    },
 +
]
 +
 
 +
// Blockieren Rechtsklick Videos
 +
$(document).ready(function () {
 +
  $('video').on('contextmenu', function (e) {
 +
    return false;
 +
  });
 
});
 
});

Aktuelle Version vom 19. Mai 2025, 09:22 Uhr

$.fn.extend({
    treed: function (o) {

      var openedClass = 'fa-minus-circle';
      var closedClass = 'fa-plus-circle';

      if (typeof o != 'undefined'){
        if (typeof o.openedClass != 'undefined'){
        openedClass = o.openedClass;
        }
        if (typeof o.closedClass != 'undefined'){
        closedClass = o.closedClass;
        }
      };

        //initialize each of the top levels
        var tree = $(this);
        tree.addClass("tree");
        tree.find('li').has("ul").each(function () {
            var branch = $(this); //li with children ul
            branch.prepend("");
            branch.addClass('branch');
            branch.on('click', function (e) {
                if (this == e.target) {
                    var icon = $(this).children('i:first');
                    icon.toggleClass(openedClass + " " + closedClass);
                    $(this).children().children().toggle();
                }
            })
            branch.children().children().toggle();
        });
        //fire event from the dynamically added icon
      tree.find('.branch .indicator').each(function(){
        $(this).on('click', function () {
            $(this).closest('li').click();
        });
      });
        //fire event to open branch if the li contains an anchor instead of text
        tree.find('.branch>a').each(function () {
            $(this).on('click', function (e) {
                $(this).closest('li').click();
                e.preventDefault();
            });
        });
        //fire event to open branch if the li contains a button instead of text
        tree.find('.branch>button').each(function () {
            $(this).on('click', function (e) {
                $(this).closest('li').click();
                e.preventDefault();
            });
        });
    }
});

//Initialization of treeviews

$('#tree1').treed();

$('#tree2').treed({openedClass:'fa-folder-open', closedClass:'fa-folder'});


 $('#tree').treeview({
    data: tree,
    levels: 5,
    backColor: 'white',
    expandIcon: "glyphicon glyphicon-triangle-right",
    collapseIcon: "glyphicon glyphicon-triangle-bottom",
    showBorder: false,
    enableLinks: true
});
       var tree = [
    {
        text: "Assets",
        href: "http://localhost:63690/asset/index",
        nodes: [
        {
            text: "Barcode"
        },
        {
            text: "Importation"
        }
        ]
    },
]

// Blockieren Rechtsklick Videos
$(document).ready(function () {
  $('video').on('contextmenu', function (e) {
    return false;
  });
});