enmi12/glossaire/js/fake-element.js
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 0 d970ebf37754
permissions -rwxr-xr-x
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
var fakeElement = {};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
fakeElement.constanants = 'b c d f g k l m n p q r s t v x z'.split(' ');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
fakeElement.vowels = 'a e i o u y'.split(' ');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
fakeElement.categories = 'alkali alkaline-earth lanthanoid actinoid transition post-transition'.split(' ');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
fakeElement.suffices = 'on ium ogen'.split(' ');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
fakeElement.getRandom = function( property ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
  var values = fakeElement[ property ];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
  return values[ Math.floor( Math.random() * values.length ) ];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
fakeElement.create = function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
  var widthClass = Math.random()*10 > 6 ? 'width2' : 'width1';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
      heightClass = Math.random()*10 > 6 ? 'height2' : 'height1';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
      category = fakeElement.getRandom('categories');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
      className = 'element fake metal ' + category + ' ' + widthClass + ' ' + heightClass;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
      letter1 = fakeElement.getRandom('constanants').toUpperCase();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
      letter2 = fakeElement.getRandom('constanants');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
      symbol = letter1 + letter2;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
      name = letter1 + fakeElement.getRandom('vowels') + letter2 + fakeElement.getRandom('vowels') + fakeElement.getRandom('constanants') + fakeElement.getRandom('suffices');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
      number = ~~( 21 + Math.random() * 100 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
      weight = ~~( number * 2 + Math.random() * 15 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
      
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
  return '<div class="' + className + '" data-symbol="' + symbol + 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
    '" data-category="' + category + '"><p class="number">' + number + 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
    '</p><h3 class="symbol">' + symbol + '</h3><h2 class="name">' + name + 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
    '</h2><p class="weight">' + weight + '</p></div>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
fakeElement.getGroup = function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
  var i = Math.ceil( Math.random()*3 + 1 ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
      newEls = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
  while ( i-- ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
    newEls += fakeElement.create();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
  }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
  return newEls;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
};