@bebranded/bb-contents 1.0.122 → 1.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bb-contents.js +313 -19
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BeBranded Contents
3
3
  * Contenus additionnels français pour Webflow
4
- * @version 1.0.122
4
+ * @version 1.0.124
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -32,16 +32,19 @@
32
32
  window._bbContentsInitialized = true;
33
33
 
34
34
  // Log de démarrage simple (une seule fois)
35
- console.log('bb-contents | v1.0.122');
35
+ console.log('bb-contents | v1.0.124');
36
36
 
37
37
  // Configuration
38
38
  const config = {
39
- version: '1.0.122',
39
+ version: '1.0.124',
40
40
  debug: false, // Debug désactivé pour rendu propre
41
41
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
42
42
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
43
43
  i18n: {
44
- copied: 'Lien copié !'
44
+ copied: 'Lien copié !',
45
+ selectCountry: { fr: 'Sélectionner un pays', en: 'Select country' },
46
+ searchCountry: { fr: 'Rechercher un pays...', en: 'Search country...' },
47
+ noCountryFound: { fr: 'Aucun pays trouvé', en: 'No country found' }
45
48
  }
46
49
  };
47
50
 
@@ -590,10 +593,10 @@
590
593
  // Toutes les images sont chargées ET ont leurs dimensions
591
594
  // Attendre plus longtemps sur mobile Safari pour le rendu visuel
592
595
  const renderDelay = isSafari && isMobile ? 1500 : (isMobile ? 1000 : 200);
593
- setTimeout(() => {
594
- startSafariAnimation();
595
- }, renderDelay);
596
- } else {
596
+ setTimeout(() => {
597
+ startSafariAnimation();
598
+ }, renderDelay);
599
+ } else {
597
600
  // Continuer à attendre que les dimensions soient disponibles
598
601
  setTimeout(waitForImages, 100);
599
602
  }
@@ -669,7 +672,7 @@
669
672
  let currentPosition;
670
673
  if (direction === (isVertical ? 'bottom' : 'right')) {
671
674
  currentPosition = -(finalContentSize + gapSize);
672
- } else {
675
+ } else {
673
676
  currentPosition = 0;
674
677
  }
675
678
 
@@ -678,7 +681,7 @@
678
681
  ? `translate3d(0, ${currentPosition}px, 0)`
679
682
  : `translate3d(${currentPosition}px, 0, 0)`;
680
683
  scrollContainer.style.transform = initialTransform;
681
-
684
+
682
685
  // OPTIMISATION SAFARI MOBILE : Forcer un reflow avant de démarrer l'animation
683
686
  if (isSafari && isMobile) {
684
687
  void scrollContainer.offsetHeight;
@@ -697,7 +700,7 @@
697
700
  if (currentPosition >= 0) {
698
701
  currentPosition = -(finalContentSize + gapSize);
699
702
  }
700
- } else {
703
+ } else {
701
704
  currentPosition -= step * deltaTime;
702
705
  if (currentPosition <= -(2 * (finalContentSize + gapSize))) {
703
706
  currentPosition = -(finalContentSize + gapSize);
@@ -726,10 +729,10 @@
726
729
  });
727
730
  });
728
731
  } else {
729
- setTimeout(() => {
732
+ setTimeout(() => {
730
733
  lastTime = performance.now();
731
734
  animate(lastTime);
732
- }, 50);
735
+ }, 50);
733
736
  }
734
737
 
735
738
  // Pause au survol pour Safari
@@ -1119,7 +1122,7 @@
1119
1122
  if (element.bbProcessed) return;
1120
1123
  element.bbProcessed = true;
1121
1124
 
1122
- const targetSelector = bbContents._getAttr(element, 'bb-reading-time-target');
1125
+ const targetSelector = bbContents._getAttr(element, 'bb-reading-time-target');
1123
1126
  const speedAttr = bbContents._getAttr(element, 'bb-reading-time-speed');
1124
1127
  const imageSpeedAttr = bbContents._getAttr(element, 'bb-reading-time-image-speed');
1125
1128
  const format = bbContents._getAttr(element, 'bb-reading-time-format') || '{minutes} min';
@@ -1127,12 +1130,12 @@
1127
1130
 
1128
1131
  // Validation et correction des valeurs
1129
1132
  let wordsPerMinute = Number(speedAttr);
1130
- if (isNaN(wordsPerMinute) || wordsPerMinute <= 0) {
1133
+ if (isNaN(wordsPerMinute) || wordsPerMinute <= 0) {
1131
1134
  wordsPerMinute = 230;
1132
- }
1135
+ }
1133
1136
 
1134
1137
  let secondsPerImage = Number(imageSpeedAttr);
1135
- if (isNaN(secondsPerImage) || secondsPerImage < 0) {
1138
+ if (isNaN(secondsPerImage) || secondsPerImage < 0) {
1136
1139
  secondsPerImage = 12;
1137
1140
  }
1138
1141
 
@@ -1184,7 +1187,7 @@
1184
1187
  sourceNodes = [element];
1185
1188
  } else {
1186
1189
  sourceNodes = Array.from(foundNodes);
1187
- }
1190
+ }
1188
1191
  } else {
1189
1192
  sourceNodes = [element];
1190
1193
  }
@@ -1215,6 +1218,297 @@
1215
1218
  }
1216
1219
  },
1217
1220
 
1221
+ // Module Country Select
1222
+ countrySelect: {
1223
+ // Liste complète des pays ISO 3166
1224
+ countries: [
1225
+ {alpha2:'AD',alpha3:'AND',name:{fr:'Andorre',en:'Andorra'}},{alpha2:'AE',alpha3:'ARE',name:{fr:'Émirats arabes unis',en:'United Arab Emirates'}},{alpha2:'AF',alpha3:'AFG',name:{fr:'Afghanistan',en:'Afghanistan'}},{alpha2:'AG',alpha3:'ATG',name:{fr:'Antigua-et-Barbuda',en:'Antigua and Barbuda'}},{alpha2:'AI',alpha3:'AIA',name:{fr:'Anguilla',en:'Anguilla'}},{alpha2:'AL',alpha3:'ALB',name:{fr:'Albanie',en:'Albania'}},{alpha2:'AM',alpha3:'ARM',name:{fr:'Arménie',en:'Armenia'}},{alpha2:'AO',alpha3:'AGO',name:{fr:'Angola',en:'Angola'}},{alpha2:'AQ',alpha3:'ATA',name:{fr:'Antarctique',en:'Antarctica'}},{alpha2:'AR',alpha3:'ARG',name:{fr:'Argentine',en:'Argentina'}},{alpha2:'AS',alpha3:'ASM',name:{fr:'Samoa américaines',en:'American Samoa'}},{alpha2:'AT',alpha3:'AUT',name:{fr:'Autriche',en:'Austria'}},{alpha2:'AU',alpha3:'AUS',name:{fr:'Australie',en:'Australia'}},{alpha2:'AW',alpha3:'ABW',name:{fr:'Aruba',en:'Aruba'}},{alpha2:'AX',alpha3:'ALA',name:{fr:'Åland',en:'Åland Islands'}},{alpha2:'AZ',alpha3:'AZE',name:{fr:'Azerbaïdjan',en:'Azerbaijan'}},{alpha2:'BA',alpha3:'BIH',name:{fr:'Bosnie-Herzégovine',en:'Bosnia and Herzegovina'}},{alpha2:'BB',alpha3:'BRB',name:{fr:'Barbade',en:'Barbados'}},{alpha2:'BD',alpha3:'BGD',name:{fr:'Bangladesh',en:'Bangladesh'}},{alpha2:'BE',alpha3:'BEL',name:{fr:'Belgique',en:'Belgium'}},{alpha2:'BF',alpha3:'BFA',name:{fr:'Burkina Faso',en:'Burkina Faso'}},{alpha2:'BG',alpha3:'BGR',name:{fr:'Bulgarie',en:'Bulgaria'}},{alpha2:'BH',alpha3:'BHR',name:{fr:'Bahreïn',en:'Bahrain'}},{alpha2:'BI',alpha3:'BDI',name:{fr:'Burundi',en:'Burundi'}},{alpha2:'BJ',alpha3:'BEN',name:{fr:'Bénin',en:'Benin'}},{alpha2:'BL',alpha3:'BLM',name:{fr:'Saint-Barthélemy',en:'Saint Barthélemy'}},{alpha2:'BM',alpha3:'BMU',name:{fr:'Bermudes',en:'Bermuda'}},{alpha2:'BN',alpha3:'BRN',name:{fr:'Brunei',en:'Brunei'}},{alpha2:'BO',alpha3:'BOL',name:{fr:'Bolivie',en:'Bolivia'}},{alpha2:'BQ',alpha3:'BES',name:{fr:'Pays-Bas caribéens',en:'Caribbean Netherlands'}},{alpha2:'BR',alpha3:'BRA',name:{fr:'Brésil',en:'Brazil'}},{alpha2:'BS',alpha3:'BHS',name:{fr:'Bahamas',en:'Bahamas'}},{alpha2:'BT',alpha3:'BTN',name:{fr:'Bhoutan',en:'Bhutan'}},{alpha2:'BV',alpha3:'BVT',name:{fr:'Île Bouvet',en:'Bouvet Island'}},{alpha2:'BW',alpha3:'BWA',name:{fr:'Botswana',en:'Botswana'}},{alpha2:'BY',alpha3:'BLR',name:{fr:'Biélorussie',en:'Belarus'}},{alpha2:'BZ',alpha3:'BLZ',name:{fr:'Belize',en:'Belize'}},{alpha2:'CA',alpha3:'CAN',name:{fr:'Canada',en:'Canada'}},{alpha2:'CC',alpha3:'CCK',name:{fr:'Îles Cocos',en:'Cocos Islands'}},{alpha2:'CD',alpha3:'COD',name:{fr:'République démocratique du Congo',en:'Democratic Republic of the Congo'}},{alpha2:'CF',alpha3:'CAF',name:{fr:'République centrafricaine',en:'Central African Republic'}},{alpha2:'CG',alpha3:'COG',name:{fr:'Congo',en:'Republic of the Congo'}},{alpha2:'CH',alpha3:'CHE',name:{fr:'Suisse',en:'Switzerland'}},{alpha2:'CI',alpha3:'CIV',name:{fr:"Côte d'Ivoire",en:'Ivory Coast'}},{alpha2:'CK',alpha3:'COK',name:{fr:'Îles Cook',en:'Cook Islands'}},{alpha2:'CL',alpha3:'CHL',name:{fr:'Chili',en:'Chile'}},{alpha2:'CM',alpha3:'CMR',name:{fr:'Cameroun',en:'Cameroon'}},{alpha2:'CN',alpha3:'CHN',name:{fr:'Chine',en:'China'}},{alpha2:'CO',alpha3:'COL',name:{fr:'Colombie',en:'Colombia'}},{alpha2:'CR',alpha3:'CRI',name:{fr:'Costa Rica',en:'Costa Rica'}},{alpha2:'CU',alpha3:'CUB',name:{fr:'Cuba',en:'Cuba'}},{alpha2:'CV',alpha3:'CPV',name:{fr:'Cap-Vert',en:'Cape Verde'}},{alpha2:'CW',alpha3:'CUW',name:{fr:'Curaçao',en:'Curaçao'}},{alpha2:'CX',alpha3:'CXR',name:{fr:'Île Christmas',en:'Christmas Island'}},{alpha2:'CY',alpha3:'CYP',name:{fr:'Chypre',en:'Cyprus'}},{alpha2:'CZ',alpha3:'CZE',name:{fr:'Tchéquie',en:'Czechia'}},{alpha2:'DE',alpha3:'DEU',name:{fr:'Allemagne',en:'Germany'}},{alpha2:'DJ',alpha3:'DJI',name:{fr:'Djibouti',en:'Djibouti'}},{alpha2:'DK',alpha3:'DNK',name:{fr:'Danemark',en:'Denmark'}},{alpha2:'DM',alpha3:'DMA',name:{fr:'Dominique',en:'Dominica'}},{alpha2:'DO',alpha3:'DOM',name:{fr:'République dominicaine',en:'Dominican Republic'}},{alpha2:'DZ',alpha3:'DZA',name:{fr:'Algérie',en:'Algeria'}},{alpha2:'EC',alpha3:'ECU',name:{fr:'Équateur',en:'Ecuador'}},{alpha2:'EE',alpha3:'EST',name:{fr:'Estonie',en:'Estonia'}},{alpha2:'EG',alpha3:'EGY',name:{fr:'Égypte',en:'Egypt'}},{alpha2:'EH',alpha3:'ESH',name:{fr:'Sahara occidental',en:'Western Sahara'}},{alpha2:'ER',alpha3:'ERI',name:{fr:'Érythrée',en:'Eritrea'}},{alpha2:'ES',alpha3:'ESP',name:{fr:'Espagne',en:'Spain'}},{alpha2:'ET',alpha3:'ETH',name:{fr:'Éthiopie',en:'Ethiopia'}},{alpha2:'FI',alpha3:'FIN',name:{fr:'Finlande',en:'Finland'}},{alpha2:'FJ',alpha3:'FJI',name:{fr:'Fidji',en:'Fiji'}},{alpha2:'FK',alpha3:'FLK',name:{fr:'Îles Malouines',en:'Falkland Islands'}},{alpha2:'FM',alpha3:'FSM',name:{fr:'Micronésie',en:'Micronesia'}},{alpha2:'FO',alpha3:'FRO',name:{fr:'Îles Féroé',en:'Faroe Islands'}},{alpha2:'FR',alpha3:'FRA',name:{fr:'France',en:'France'}},{alpha2:'GA',alpha3:'GAB',name:{fr:'Gabon',en:'Gabon'}},{alpha2:'GB',alpha3:'GBR',name:{fr:'Royaume-Uni',en:'United Kingdom'}},{alpha2:'GD',alpha3:'GRD',name:{fr:'Grenade',en:'Grenada'}},{alpha2:'GE',alpha3:'GEO',name:{fr:'Géorgie',en:'Georgia'}},{alpha2:'GF',alpha3:'GUF',name:{fr:'Guyane française',en:'French Guiana'}},{alpha2:'GG',alpha3:'GGY',name:{fr:'Guernesey',en:'Guernsey'}},{alpha2:'GH',alpha3:'GHA',name:{fr:'Ghana',en:'Ghana'}},{alpha2:'GI',alpha3:'GIB',name:{fr:'Gibraltar',en:'Gibraltar'}},{alpha2:'GL',alpha3:'GRL',name:{fr:'Groenland',en:'Greenland'}},{alpha2:'GM',alpha3:'GMB',name:{fr:'Gambie',en:'Gambia'}},{alpha2:'GN',alpha3:'GIN',name:{fr:'Guinée',en:'Guinea'}},{alpha2:'GP',alpha3:'GLP',name:{fr:'Guadeloupe',en:'Guadeloupe'}},{alpha2:'GQ',alpha3:'GNQ',name:{fr:'Guinée équatoriale',en:'Equatorial Guinea'}},{alpha2:'GR',alpha3:'GRC',name:{fr:'Grèce',en:'Greece'}},{alpha2:'GS',alpha3:'SGS',name:{fr:'Géorgie du Sud-et-les Îles Sandwich du Sud',en:'South Georgia and the South Sandwich Islands'}},{alpha2:'GT',alpha3:'GTM',name:{fr:'Guatemala',en:'Guatemala'}},{alpha2:'GU',alpha3:'GUM',name:{fr:'Guam',en:'Guam'}},{alpha2:'GW',alpha3:'GNB',name:{fr:'Guinée-Bissau',en:'Guinea-Bissau'}},{alpha2:'GY',alpha3:'GUY',name:{fr:'Guyane',en:'Guyana'}},{alpha2:'HK',alpha3:'HKG',name:{fr:'Hong Kong',en:'Hong Kong'}},{alpha2:'HM',alpha3:'HMD',name:{fr:'Îles Heard-et-MacDonald',en:'Heard Island and McDonald Islands'}},{alpha2:'HN',alpha3:'HND',name:{fr:'Honduras',en:'Honduras'}},{alpha2:'HR',alpha3:'HRV',name:{fr:'Croatie',en:'Croatia'}},{alpha2:'HT',alpha3:'HTI',name:{fr:'Haïti',en:'Haiti'}},{alpha2:'HU',alpha3:'HUN',name:{fr:'Hongrie',en:'Hungary'}},{alpha2:'ID',alpha3:'IDN',name:{fr:'Indonésie',en:'Indonesia'}},{alpha2:'IE',alpha3:'IRL',name:{fr:'Irlande',en:'Ireland'}},{alpha2:'IL',alpha3:'ISR',name:{fr:'Israël',en:'Israel'}},{alpha2:'IM',alpha3:'IMN',name:{fr:'Île de Man',en:'Isle of Man'}},{alpha2:'IN',alpha3:'IND',name:{fr:'Inde',en:'India'}},{alpha2:'IO',alpha3:'IOT',name:{fr:'Territoire britannique de l\'océan Indien',en:'British Indian Ocean Territory'}},{alpha2:'IQ',alpha3:'IRQ',name:{fr:'Irak',en:'Iraq'}},{alpha2:'IR',alpha3:'IRN',name:{fr:'Iran',en:'Iran'}},{alpha2:'IS',alpha3:'ISL',name:{fr:'Islande',en:'Iceland'}},{alpha2:'IT',alpha3:'ITA',name:{fr:'Italie',en:'Italy'}},{alpha2:'JE',alpha3:'JEY',name:{fr:'Jersey',en:'Jersey'}},{alpha2:'JM',alpha3:'JAM',name:{fr:'Jamaïque',en:'Jamaica'}},{alpha2:'JO',alpha3:'JOR',name:{fr:'Jordanie',en:'Jordan'}},{alpha2:'JP',alpha3:'JPN',name:{fr:'Japon',en:'Japan'}},{alpha2:'KE',alpha3:'KEN',name:{fr:'Kenya',en:'Kenya'}},{alpha2:'KG',alpha3:'KGZ',name:{fr:'Kirghizistan',en:'Kyrgyzstan'}},{alpha2:'KH',alpha3:'KHM',name:{fr:'Cambodge',en:'Cambodia'}},{alpha2:'KI',alpha3:'KIR',name:{fr:'Kiribati',en:'Kiribati'}},{alpha2:'KM',alpha3:'COM',name:{fr:'Comores',en:'Comoros'}},{alpha2:'KN',alpha3:'KNA',name:{fr:'Saint-Kitts-et-Nevis',en:'Saint Kitts and Nevis'}},{alpha2:'KP',alpha3:'PRK',name:{fr:'Corée du Nord',en:'North Korea'}},{alpha2:'KR',alpha3:'KOR',name:{fr:'Corée du Sud',en:'South Korea'}},{alpha2:'KW',alpha3:'KWT',name:{fr:'Koweït',en:'Kuwait'}},{alpha2:'KY',alpha3:'CYM',name:{fr:'Îles Caïmans',en:'Cayman Islands'}},{alpha2:'KZ',alpha3:'KAZ',name:{fr:'Kazakhstan',en:'Kazakhstan'}},{alpha2:'LA',alpha3:'LAO',name:{fr:'Laos',en:'Laos'}},{alpha2:'LB',alpha3:'LBN',name:{fr:'Liban',en:'Lebanon'}},{alpha2:'LC',alpha3:'LCA',name:{fr:'Sainte-Lucie',en:'Saint Lucia'}},{alpha2:'LI',alpha3:'LIE',name:{fr:'Liechtenstein',en:'Liechtenstein'}},{alpha2:'LK',alpha3:'LKA',name:{fr:'Sri Lanka',en:'Sri Lanka'}},{alpha2:'LR',alpha3:'LBR',name:{fr:'Liberia',en:'Liberia'}},{alpha2:'LS',alpha3:'LSO',name:{fr:'Lesotho',en:'Lesotho'}},{alpha2:'LT',alpha3:'LTU',name:{fr:'Lituanie',en:'Lithuania'}},{alpha2:'LU',alpha3:'LUX',name:{fr:'Luxembourg',en:'Luxembourg'}},{alpha2:'LV',alpha3:'LVA',name:{fr:'Lettonie',en:'Latvia'}},{alpha2:'LY',alpha3:'LBY',name:{fr:'Libye',en:'Libya'}},{alpha2:'MA',alpha3:'MAR',name:{fr:'Maroc',en:'Morocco'}},{alpha2:'MC',alpha3:'MCO',name:{fr:'Monaco',en:'Monaco'}},{alpha2:'MD',alpha3:'MDA',name:{fr:'Moldavie',en:'Moldova'}},{alpha2:'ME',alpha3:'MNE',name:{fr:'Monténégro',en:'Montenegro'}},{alpha2:'MF',alpha3:'MAF',name:{fr:'Saint-Martin',en:'Saint Martin'}},{alpha2:'MG',alpha3:'MDG',name:{fr:'Madagascar',en:'Madagascar'}},{alpha2:'MH',alpha3:'MHL',name:{fr:'Îles Marshall',en:'Marshall Islands'}},{alpha2:'MK',alpha3:'MKD',name:{fr:'Macédoine du Nord',en:'North Macedonia'}},{alpha2:'ML',alpha3:'MLI',name:{fr:'Mali',en:'Mali'}},{alpha2:'MM',alpha3:'MMR',name:{fr:'Myanmar',en:'Myanmar'}},{alpha2:'MN',alpha3:'MNG',name:{fr:'Mongolie',en:'Mongolia'}},{alpha2:'MO',alpha3:'MAC',name:{fr:'Macao',en:'Macao'}},{alpha2:'MP',alpha3:'MNP',name:{fr:'Îles Mariannes du Nord',en:'Northern Mariana Islands'}},{alpha2:'MQ',alpha3:'MTQ',name:{fr:'Martinique',en:'Martinique'}},{alpha2:'MR',alpha3:'MRT',name:{fr:'Mauritanie',en:'Mauritania'}},{alpha2:'MS',alpha3:'MSR',name:{fr:'Montserrat',en:'Montserrat'}},{alpha2:'MT',alpha3:'MLT',name:{fr:'Malte',en:'Malta'}},{alpha2:'MU',alpha3:'MUS',name:{fr:'Maurice',en:'Mauritius'}},{alpha2:'MV',alpha3:'MDV',name:{fr:'Maldives',en:'Maldives'}},{alpha2:'MW',alpha3:'MWI',name:{fr:'Malawi',en:'Malawi'}},{alpha2:'MX',alpha3:'MEX',name:{fr:'Mexique',en:'Mexico'}},{alpha2:'MY',alpha3:'MYS',name:{fr:'Malaisie',en:'Malaysia'}},{alpha2:'MZ',alpha3:'MOZ',name:{fr:'Mozambique',en:'Mozambique'}},{alpha2:'NA',alpha3:'NAM',name:{fr:'Namibie',en:'Namibia'}},{alpha2:'NC',alpha3:'NCL',name:{fr:'Nouvelle-Calédonie',en:'New Caledonia'}},{alpha2:'NE',alpha3:'NER',name:{fr:'Niger',en:'Niger'}},{alpha2:'NF',alpha3:'NFK',name:{fr:'Île Norfolk',en:'Norfolk Island'}},{alpha2:'NG',alpha3:'NGA',name:{fr:'Nigeria',en:'Nigeria'}},{alpha2:'NI',alpha3:'NIC',name:{fr:'Nicaragua',en:'Nicaragua'}},{alpha2:'NL',alpha3:'NLD',name:{fr:'Pays-Bas',en:'Netherlands'}},{alpha2:'NO',alpha3:'NOR',name:{fr:'Norvège',en:'Norway'}},{alpha2:'NP',alpha3:'NPL',name:{fr:'Népal',en:'Nepal'}},{alpha2:'NR',alpha3:'NRU',name:{fr:'Nauru',en:'Nauru'}},{alpha2:'NU',alpha3:'NIU',name:{fr:'Niue',en:'Niue'}},{alpha2:'NZ',alpha3:'NZL',name:{fr:'Nouvelle-Zélande',en:'New Zealand'}},{alpha2:'OM',alpha3:'OMN',name:{fr:'Oman',en:'Oman'}},{alpha2:'PA',alpha3:'PAN',name:{fr:'Panama',en:'Panama'}},{alpha2:'PE',alpha3:'PER',name:{fr:'Pérou',en:'Peru'}},{alpha2:'PF',alpha3:'PYF',name:{fr:'Polynésie française',en:'French Polynesia'}},{alpha2:'PG',alpha3:'PNG',name:{fr:'Papouasie-Nouvelle-Guinée',en:'Papua New Guinea'}},{alpha2:'PH',alpha3:'PHL',name:{fr:'Philippines',en:'Philippines'}},{alpha2:'PK',alpha3:'PAK',name:{fr:'Pakistan',en:'Pakistan'}},{alpha2:'PL',alpha3:'POL',name:{fr:'Pologne',en:'Poland'}},{alpha2:'PM',alpha3:'SPM',name:{fr:'Saint-Pierre-et-Miquelon',en:'Saint Pierre and Miquelon'}},{alpha2:'PN',alpha3:'PCN',name:{fr:'Pitcairn',en:'Pitcairn'}},{alpha2:'PR',alpha3:'PRI',name:{fr:'Porto Rico',en:'Puerto Rico'}},{alpha2:'PS',alpha3:'PSE',name:{fr:'Palestine',en:'Palestine'}},{alpha2:'PT',alpha3:'PRT',name:{fr:'Portugal',en:'Portugal'}},{alpha2:'PW',alpha3:'PLW',name:{fr:'Palaos',en:'Palau'}},{alpha2:'PY',alpha3:'PRY',name:{fr:'Paraguay',en:'Paraguay'}},{alpha2:'QA',alpha3:'QAT',name:{fr:'Qatar',en:'Qatar'}},{alpha2:'RE',alpha3:'REU',name:{fr:'La Réunion',en:'Réunion'}},{alpha2:'RO',alpha3:'ROU',name:{fr:'Roumanie',en:'Romania'}},{alpha2:'RS',alpha3:'SRB',name:{fr:'Serbie',en:'Serbia'}},{alpha2:'RU',alpha3:'RUS',name:{fr:'Russie',en:'Russia'}},{alpha2:'RW',alpha3:'RWA',name:{fr:'Rwanda',en:'Rwanda'}},{alpha2:'SA',alpha3:'SAU',name:{fr:'Arabie saoudite',en:'Saudi Arabia'}},{alpha2:'SB',alpha3:'SLB',name:{fr:'Îles Salomon',en:'Solomon Islands'}},{alpha2:'SC',alpha3:'SYC',name:{fr:'Seychelles',en:'Seychelles'}},{alpha2:'SD',alpha3:'SDN',name:{fr:'Soudan',en:'Sudan'}},{alpha2:'SE',alpha3:'SWE',name:{fr:'Suède',en:'Sweden'}},{alpha2:'SG',alpha3:'SGP',name:{fr:'Singapour',en:'Singapore'}},{alpha2:'SH',alpha3:'SHN',name:{fr:'Sainte-Hélène',en:'Saint Helena'}},{alpha2:'SI',alpha3:'SVN',name:{fr:'Slovénie',en:'Slovenia'}},{alpha2:'SJ',alpha3:'SJM',name:{fr:'Svalbard et Jan Mayen',en:'Svalbard and Jan Mayen'}},{alpha2:'SK',alpha3:'SVK',name:{fr:'Slovaquie',en:'Slovakia'}},{alpha2:'SL',alpha3:'SLE',name:{fr:'Sierra Leone',en:'Sierra Leone'}},{alpha2:'SM',alpha3:'SMR',name:{fr:'Saint-Marin',en:'San Marino'}},{alpha2:'SN',alpha3:'SEN',name:{fr:'Sénégal',en:'Senegal'}},{alpha2:'SO',alpha3:'SOM',name:{fr:'Somalie',en:'Somalia'}},{alpha2:'SR',alpha3:'SUR',name:{fr:'Suriname',en:'Suriname'}},{alpha2:'SS',alpha3:'SSD',name:{fr:'Soudan du Sud',en:'South Sudan'}},{alpha2:'ST',alpha3:'STP',name:{fr:'São Tomé-et-Príncipe',en:'São Tomé and Príncipe'}},{alpha2:'SV',alpha3:'SLV',name:{fr:'Salvador',en:'El Salvador'}},{alpha2:'SX',alpha3:'SXM',name:{fr:'Saint-Martin',en:'Sint Maarten'}},{alpha2:'SY',alpha3:'SYR',name:{fr:'Syrie',en:'Syria'}},{alpha2:'SZ',alpha3:'SWZ',name:{fr:'Eswatini',en:'Eswatini'}},{alpha2:'TC',alpha3:'TCA',name:{fr:'Îles Turques-et-Caïques',en:'Turks and Caicos Islands'}},{alpha2:'TD',alpha3:'TCD',name:{fr:'Tchad',en:'Chad'}},{alpha2:'TF',alpha3:'ATF',name:{fr:'Terres australes françaises',en:'French Southern Territories'}},{alpha2:'TG',alpha3:'TGO',name:{fr:'Togo',en:'Togo'}},{alpha2:'TH',alpha3:'THA',name:{fr:'Thaïlande',en:'Thailand'}},{alpha2:'TJ',alpha3:'TJK',name:{fr:'Tadjikistan',en:'Tajikistan'}},{alpha2:'TK',alpha3:'TKL',name:{fr:'Tokelau',en:'Tokelau'}},{alpha2:'TL',alpha3:'TLS',name:{fr:'Timor oriental',en:'Timor-Leste'}},{alpha2:'TM',alpha3:'TKM',name:{fr:'Turkménistan',en:'Turkmenistan'}},{alpha2:'TN',alpha3:'TUN',name:{fr:'Tunisie',en:'Tunisia'}},{alpha2:'TO',alpha3:'TON',name:{fr:'Tonga',en:'Tonga'}},{alpha2:'TR',alpha3:'TUR',name:{fr:'Turquie',en:'Turkey'}},{alpha2:'TT',alpha3:'TTO',name:{fr:'Trinité-et-Tobago',en:'Trinidad and Tobago'}},{alpha2:'TV',alpha3:'TUV',name:{fr:'Tuvalu',en:'Tuvalu'}},{alpha2:'TW',alpha3:'TWN',name:{fr:'Taïwan',en:'Taiwan'}},{alpha2:'TZ',alpha3:'TZA',name:{fr:'Tanzanie',en:'Tanzania'}},{alpha2:'UA',alpha3:'UKR',name:{fr:'Ukraine',en:'Ukraine'}},{alpha2:'UG',alpha3:'UGA',name:{fr:'Ouganda',en:'Uganda'}},{alpha2:'UM',alpha3:'UMI',name:{fr:'Îles mineures éloignées des États-Unis',en:'United States Minor Outlying Islands'}},{alpha2:'US',alpha3:'USA',name:{fr:'États-Unis',en:'United States'}},{alpha2:'UY',alpha3:'URY',name:{fr:'Uruguay',en:'Uruguay'}},{alpha2:'UZ',alpha3:'UZB',name:{fr:'Ouzbékistan',en:'Uzbekistan'}},{alpha2:'VA',alpha3:'VAT',name:{fr:'Vatican',en:'Vatican City'}},{alpha2:'VC',alpha3:'VCT',name:{fr:'Saint-Vincent-et-les-Grenadines',en:'Saint Vincent and the Grenadines'}},{alpha2:'VE',alpha3:'VEN',name:{fr:'Venezuela',en:'Venezuela'}},{alpha2:'VG',alpha3:'VGB',name:{fr:'Îles Vierges britanniques',en:'British Virgin Islands'}},{alpha2:'VI',alpha3:'VIR',name:{fr:'Îles Vierges américaines',en:'United States Virgin Islands'}},{alpha2:'VN',alpha3:'VNM',name:{fr:'Vietnam',en:'Vietnam'}},{alpha2:'VU',alpha3:'VUT',name:{fr:'Vanuatu',en:'Vanuatu'}},{alpha2:'WF',alpha3:'WLF',name:{fr:'Wallis-et-Futuna',en:'Wallis and Futuna'}},{alpha2:'WS',alpha3:'WSM',name:{fr:'Samoa',en:'Samoa'}},{alpha2:'YE',alpha3:'YEM',name:{fr:'Yémen',en:'Yemen'}},{alpha2:'YT',alpha3:'MYT',name:{fr:'Mayotte',en:'Mayotte'}},{alpha2:'ZA',alpha3:'ZAF',name:{fr:'Afrique du Sud',en:'South Africa'}},{alpha2:'ZM',alpha3:'ZMB',name:{fr:'Zambie',en:'Zambia'}},{alpha2:'ZW',alpha3:'ZWE',name:{fr:'Zimbabwe',en:'Zimbabwe'}}
1226
+ ],
1227
+
1228
+ // Détecter la langue
1229
+ getLanguage: function(element) {
1230
+ const lang = element.getAttribute('lang') ||
1231
+ (element.closest && element.closest('[lang]') ? element.closest('[lang]').getAttribute('lang') : null) ||
1232
+ document.documentElement.getAttribute('lang') ||
1233
+ 'fr';
1234
+ return lang.startsWith('en') ? 'en' : 'fr';
1235
+ },
1236
+
1237
+ // Trouver un pays par code ou nom
1238
+ findCountry: function(query) {
1239
+ if (!query) return null;
1240
+ const upperQuery = query.toUpperCase().trim();
1241
+ const lowerQuery = query.toLowerCase().trim();
1242
+ return this.countries.find(function(c) {
1243
+ return c.alpha2 === upperQuery ||
1244
+ c.alpha3 === upperQuery ||
1245
+ c.name.fr.toLowerCase() === lowerQuery ||
1246
+ c.name.en.toLowerCase() === lowerQuery;
1247
+ });
1248
+ },
1249
+
1250
+ detect: function(scope) {
1251
+ const s = scope || document;
1252
+ return s.querySelector(bbContents._attrSelector('country-select')) !== null;
1253
+ },
1254
+
1255
+ init: function(root) {
1256
+ const scope = root || document;
1257
+ if (scope.closest && scope.closest('[data-bb-disable]')) return;
1258
+ const elements = scope.querySelectorAll(bbContents._attrSelector('country-select'));
1259
+ const self = this;
1260
+
1261
+ elements.forEach(function(element) {
1262
+ if (element.bbProcessed || element.hasAttribute('data-bb-country-select-processed')) return;
1263
+ if (element.tagName !== 'SELECT') {
1264
+ return;
1265
+ }
1266
+ element.bbProcessed = true;
1267
+
1268
+ const language = self.getLanguage(element);
1269
+ const preferredAttr = bbContents._getAttr(element, 'bb-country-select-preferred');
1270
+ const defaultAttr = bbContents._getAttr(element, 'bb-country-select-default');
1271
+ const placeholder = bbContents.config.i18n.selectCountry[language] ||
1272
+ (language === 'en' ? 'Select country' : 'Sélectionner un pays');
1273
+ const searchPlaceholder = bbContents.config.i18n.searchCountry[language] ||
1274
+ (language === 'en' ? 'Search country...' : 'Rechercher un pays...');
1275
+
1276
+ // Parser les pays préférés
1277
+ let preferredCountries = [];
1278
+ if (preferredAttr) {
1279
+ preferredAttr.split(',').forEach(function(code) {
1280
+ const country = self.findCountry(code.trim());
1281
+ if (country) preferredCountries.push(country.alpha2);
1282
+ });
1283
+ }
1284
+
1285
+ // Pays par défaut
1286
+ let defaultCountry = null;
1287
+ if (defaultAttr) {
1288
+ defaultCountry = self.findCountry(defaultAttr.trim());
1289
+ } else if (element.value) {
1290
+ defaultCountry = self.findCountry(element.value);
1291
+ }
1292
+
1293
+ // Trier les pays : préférés en haut dans l'ordre exact spécifié
1294
+ let sortedCountries = self.countries.slice();
1295
+ if (preferredCountries.length > 0) {
1296
+ // Créer un map pour l'ordre des préférés
1297
+ const preferredOrder = {};
1298
+ preferredCountries.forEach(function(code, index) {
1299
+ preferredOrder[code] = index;
1300
+ });
1301
+ // Trier : préférés dans l'ordre exact, puis les autres
1302
+ sortedCountries = preferredCountries.map(function(code) {
1303
+ return self.countries.find(function(c) {
1304
+ return c.alpha2 === code;
1305
+ });
1306
+ }).filter(function(c) {
1307
+ return c !== undefined;
1308
+ }).concat(sortedCountries.filter(function(c) {
1309
+ return preferredCountries.indexOf(c.alpha2) === -1;
1310
+ }));
1311
+ }
1312
+
1313
+ // Créer le wrapper
1314
+ const wrapper = document.createElement('div');
1315
+ wrapper.className = 'bb-country-select-wrapper';
1316
+ wrapper.style.cssText = 'position: relative; width: 100%;';
1317
+
1318
+ // Masquer le select natif mais le garder fonctionnel
1319
+ const selectStyle = element.style.cssText || '';
1320
+ element.style.cssText = selectStyle + '; position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; overflow: hidden;';
1321
+ element.setAttribute('aria-hidden', 'true');
1322
+
1323
+ // Créer le bouton custom
1324
+ const trigger = document.createElement('button');
1325
+ trigger.type = 'button';
1326
+ trigger.className = 'bb-country-select-trigger';
1327
+ trigger.setAttribute('aria-haspopup', 'listbox');
1328
+ trigger.setAttribute('aria-expanded', 'false');
1329
+
1330
+ const selectedCountry = defaultCountry;
1331
+ const selectedName = selectedCountry ? selectedCountry.name[language] : placeholder;
1332
+ const selectedFlag = selectedCountry ?
1333
+ '<img src="https://hatscripts.github.io/circle-flags/flags/' + selectedCountry.alpha2.toLowerCase() + '.svg" alt="' + bbContents.utils.sanitize(selectedCountry.name[language]) + '" style="width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0;">' :
1334
+ '';
1335
+
1336
+ trigger.innerHTML = '<div style="display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;"><span class="bb-country-flag" style="flex-shrink: 0;">' + selectedFlag + '</span><span class="bb-country-name" style="flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">' + bbContents.utils.sanitize(selectedName) + '</span></div><svg width="16" height="16" viewBox="0 0 16 16" fill="none" style="flex-shrink: 0; transition: transform 0.2s;"><path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
1337
+ trigger.style.cssText = 'display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; background: white; cursor: pointer; font-size: inherit; font-family: inherit; color: inherit; transition: border-color 0.2s; box-sizing: border-box;';
1338
+
1339
+ // Variable pour stocker le pays sélectionné (pour chaque instance)
1340
+ let currentSelectedCountry = defaultCountry;
1341
+
1342
+ // Créer le popover
1343
+ const popover = document.createElement('div');
1344
+ popover.className = 'bb-country-select-popover';
1345
+ popover.setAttribute('role', 'listbox');
1346
+ popover.style.cssText = 'position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: white; border: 1px solid #e5e7eb; border-radius: 6px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); max-height: 300px; overflow: hidden; display: none; z-index: 50;';
1347
+
1348
+ // Barre de recherche
1349
+ const searchWrapper = document.createElement('div');
1350
+ searchWrapper.className = 'bb-country-search';
1351
+ searchWrapper.style.cssText = 'position: sticky; top: 0; padding: 8px; background: white; border-bottom: 1px solid #e5e7eb; z-index: 1;';
1352
+
1353
+ const searchInput = document.createElement('input');
1354
+ searchInput.type = 'text';
1355
+ searchInput.className = 'bb-country-search-input';
1356
+ searchInput.placeholder = searchPlaceholder;
1357
+ searchInput.setAttribute('aria-label', searchPlaceholder);
1358
+ searchInput.style.cssText = 'width: 100%; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 4px; font-size: inherit; font-family: inherit; box-sizing: border-box;';
1359
+
1360
+ searchWrapper.appendChild(searchInput);
1361
+ popover.appendChild(searchWrapper);
1362
+
1363
+ // Liste des pays
1364
+ const list = document.createElement('div');
1365
+ list.className = 'bb-country-list';
1366
+ list.style.cssText = 'overflow-y: auto; max-height: 250px;';
1367
+ popover.appendChild(list);
1368
+
1369
+ // Fonction pour rendre la liste
1370
+ function renderCountries(countries) {
1371
+ if (countries.length === 0) {
1372
+ const noResult = bbContents.config.i18n.noCountryFound[language] ||
1373
+ (language === 'en' ? 'No country found' : 'Aucun pays trouvé');
1374
+ list.innerHTML = '<div style="padding: 16px; text-align: center; color: #9ca3af; font-size: inherit; font-family: inherit;">' + bbContents.utils.sanitize(noResult) + '</div>';
1375
+ return;
1376
+ }
1377
+
1378
+ list.innerHTML = countries.map(function(country) {
1379
+ const isSelected = currentSelectedCountry && currentSelectedCountry.alpha2 === country.alpha2;
1380
+ return '<div class="bb-country-item" data-country="' + country.alpha2 + '" role="option" aria-selected="' + (isSelected ? 'true' : 'false') + '" style="display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: inherit; font-family: inherit; transition: background-color 0.15s;' + (isSelected ? ' background-color: #f3f4f6;' : '') + '"><img src="https://hatscripts.github.io/circle-flags/flags/' + country.alpha2.toLowerCase() + '.svg" alt="' + bbContents.utils.sanitize(country.name[language]) + '" style="width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0;"><span>' + bbContents.utils.sanitize(country.name[language]) + '</span></div>';
1381
+ }).join('');
1382
+
1383
+ // Ajouter hover effect
1384
+ list.querySelectorAll('.bb-country-item').forEach(function(item) {
1385
+ item.addEventListener('mouseenter', function() {
1386
+ if (this.getAttribute('aria-selected') !== 'true') {
1387
+ this.style.backgroundColor = '#f3f4f6';
1388
+ }
1389
+ });
1390
+ item.addEventListener('mouseleave', function() {
1391
+ if (this.getAttribute('aria-selected') !== 'true') {
1392
+ this.style.backgroundColor = '';
1393
+ }
1394
+ });
1395
+ });
1396
+ }
1397
+
1398
+ // Initialiser la liste
1399
+ renderCountries(sortedCountries);
1400
+
1401
+ // Assembler le wrapper
1402
+ const parent = element.parentNode;
1403
+ parent.insertBefore(wrapper, element);
1404
+ wrapper.appendChild(element);
1405
+ wrapper.appendChild(trigger);
1406
+ wrapper.appendChild(popover);
1407
+
1408
+ // Références
1409
+ const flagSpan = trigger.querySelector('.bb-country-flag');
1410
+ const nameSpan = trigger.querySelector('.bb-country-name');
1411
+ const chevron = trigger.querySelector('svg');
1412
+
1413
+ // Toggle dropdown
1414
+ trigger.addEventListener('click', function(e) {
1415
+ e.stopPropagation();
1416
+ const isOpen = popover.style.display === 'block';
1417
+ popover.style.display = isOpen ? 'none' : 'block';
1418
+ trigger.setAttribute('aria-expanded', isOpen ? 'false' : 'true');
1419
+ if (chevron) chevron.style.transform = isOpen ? 'rotate(0deg)' : 'rotate(180deg)';
1420
+ if (!isOpen) {
1421
+ searchInput.focus();
1422
+ searchInput.value = '';
1423
+ renderCountries(sortedCountries);
1424
+ }
1425
+ });
1426
+
1427
+ // Fermer en cliquant à l'extérieur
1428
+ document.addEventListener('click', function(e) {
1429
+ if (!wrapper.contains(e.target)) {
1430
+ popover.style.display = 'none';
1431
+ trigger.setAttribute('aria-expanded', 'false');
1432
+ if (chevron) chevron.style.transform = 'rotate(0deg)';
1433
+ }
1434
+ });
1435
+
1436
+ // Recherche
1437
+ searchInput.addEventListener('input', function(e) {
1438
+ const query = e.target.value.toLowerCase();
1439
+ const filtered = sortedCountries.filter(function(c) {
1440
+ return c.name[language].toLowerCase().indexOf(query) !== -1 ||
1441
+ c.alpha2.toLowerCase().indexOf(query) !== -1 ||
1442
+ c.alpha3.toLowerCase().indexOf(query) !== -1;
1443
+ });
1444
+ renderCountries(filtered);
1445
+ });
1446
+
1447
+ // Navigation clavier
1448
+ searchInput.addEventListener('keydown', function(e) {
1449
+ if (e.key === 'Escape') {
1450
+ popover.style.display = 'none';
1451
+ trigger.setAttribute('aria-expanded', 'false');
1452
+ if (chevron) chevron.style.transform = 'rotate(0deg)';
1453
+ trigger.focus();
1454
+ }
1455
+ });
1456
+
1457
+ // Sélectionner un pays
1458
+ list.addEventListener('click', function(e) {
1459
+ const item = e.target.closest('.bb-country-item');
1460
+ if (!item) return;
1461
+
1462
+ const countryCode = item.dataset.country;
1463
+ const country = self.countries.find(function(c) {
1464
+ return c.alpha2 === countryCode;
1465
+ });
1466
+ if (!country) return;
1467
+
1468
+ // Mettre à jour le pays sélectionné
1469
+ currentSelectedCountry = country;
1470
+
1471
+ // Mettre à jour l'affichage
1472
+ flagSpan.innerHTML = '<img src="https://hatscripts.github.io/circle-flags/flags/' + country.alpha2.toLowerCase() + '.svg" alt="' + bbContents.utils.sanitize(country.name[language]) + '" style="width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0;">';
1473
+ nameSpan.textContent = country.name[language];
1474
+
1475
+ // Mettre à jour le select natif avec le nom du pays (pas le code ISO)
1476
+ const countryName = country.name[language];
1477
+ element.value = countryName;
1478
+ // Mettre aussi le texte de l'option
1479
+ const existingOption = Array.from(element.options).find(function(opt) {
1480
+ return opt.value === countryName;
1481
+ });
1482
+ if (!existingOption) {
1483
+ // Créer l'option si elle n'existe pas
1484
+ const newOption = document.createElement('option');
1485
+ newOption.value = countryName;
1486
+ newOption.textContent = countryName;
1487
+ element.innerHTML = '';
1488
+ element.appendChild(newOption);
1489
+ }
1490
+ const changeEvent = new Event('change', { bubbles: true });
1491
+ element.dispatchEvent(changeEvent);
1492
+
1493
+ // Fermer le dropdown
1494
+ popover.style.display = 'none';
1495
+ trigger.setAttribute('aria-expanded', 'false');
1496
+ if (chevron) chevron.style.transform = 'rotate(0deg)';
1497
+ searchInput.value = '';
1498
+ renderCountries(sortedCountries);
1499
+
1500
+ // Re-render pour mettre à jour l'état sélectionné
1501
+ setTimeout(function() {
1502
+ renderCountries(sortedCountries);
1503
+ }, 0);
1504
+ });
1505
+
1506
+ wrapper.setAttribute('data-bb-country-select-processed', 'true');
1507
+ });
1508
+
1509
+ }
1510
+ },
1511
+
1218
1512
  // Module Favicon (Favicon Dynamique)
1219
1513
  favicon: {
1220
1514
  originalFavicon: null,
@@ -1504,7 +1798,7 @@
1504
1798
  const newCachedData = this.cache.get(cacheKey);
1505
1799
  if (newCachedData && newCachedData.value) {
1506
1800
  this.generateYouTubeFeed(container, template, newCachedData.value, allowShorts, language);
1507
- } else {
1801
+ } else {
1508
1802
  container.innerHTML = '<div style="padding: 20px; text-align: center; color: #6b7280;">Erreur de chargement</div>';
1509
1803
  }
1510
1804
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.122",
3
+ "version": "1.0.124",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {