X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=js%2Ftopology%2Fcards.js;fp=js%2Ftopology%2Fcards.js;h=04c0606eaa67778269166c222e2299ea5720fb62;hp=0000000000000000000000000000000000000000;hb=4ff4cfab60fd88f431c88603d57612fc489dc62f;hpb=ea20f018c05bcc4e56b2dfa3eee30af0d6ffabf3 diff --git a/js/topology/cards.js b/js/topology/cards.js new file mode 100644 index 0000000..04c0606 --- /dev/null +++ b/js/topology/cards.js @@ -0,0 +1,101 @@ +// Copyright (c) 2018 Maen Artimy +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +var BAR_IDX = 1; +var CONTAINER_IDX = 2; + +var cardControl = ( function() { + console.log("cardControl"); + var expand = function(e) { + var size = e.parentElement.parentElement.parentElement.style.width; + if(size==='96%') { // first value of size is "" + e.parentElement.parentElement.parentElement.style.width = '45%'; + } else { + e.parentElement.parentElement.parentElement.style.width = '96%'; + } + //e.classList.toggle("active"); + }; + + var collapse = function(e) { + var c = e.parentElement.parentElement.parentElement.childNodes.item(CONTAINER_IDX); + var disp = c.style.display; + if(disp == "none") { + c.style.display = "block" + } else { + c.style.display = "none"; + } + }; + + return { + expand: expand, + collapse: collapse + } +})(); + +// Generate cards dynamicly based on the template given by local 'html' variable +// and data from the 'views' list. Cards are added to the 'parent' element +// passed as argument. +var generateCards = ( function() { + console.log("generateCards"); + var html = "
No data to display...
\ +