Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

reduce untwanted footer area


Lucia_

Question

  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

5 answers to this question

Recommended Posts

  • 0

well funny enough you see the code hidden under that black banner.
it is the code for the multi language function but seems like somethings wrong @tuanphan and I don't see why

Edited by lucia.fritsche
Link to post
  • 0

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.6.0/css/flag-icon.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>


    window.Squarespace.onInitialize(Y, function(){  
    /* SETUP MULTI-LANGUAGE */
    var defaultLanguage = 'en';
    var lang = location.pathname.split("/")[1];
    var defaultClass = 'lang-'+defaultLanguage+'';
    var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']";
    if (lang == "" || lang.length > 2 ){
      var lang = defaultLanguage;
    }

    /* ADD LANGUAGE CLASSES */
    $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+'');
    $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () {
      var langType = $(this).attr('href').split("/")[1];
      var multiLanguageClass = 'multilanguage lang-' + langType + '';
      if (undefined !== langType && langType.length <= 2) {
        $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass);
      }
    });
    $('nav button').each(function () {
      var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0];
      var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + '';
      if (undefined !== langTypeFolder && langTypeFolder.length <= 2) {
        $(this).addClass(multiLanguageClass);
      }
    });

    /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
    if (lang == "en") {
      $('a[href="/"]').attr("href", "/en/online-agency/");
    }

    /* ADD EXCLUSION NAV ITEMS */
    $('.exclude-me,.exclude-me a').addClass('exclude');
    $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude');

    /* REMOVE OTHER LANGUAGES AND KEEP EXCLUDED ITEMS */
    $('.multilanguage:not(".lang-'+lang+',.exclude")').remove();

    /* SETUP LANGUAGE SWITCHER */
    $('body').prepend('<div class="language"><a href="/en/online-agency" class="lang-en"><span class="flag-icon flag-icon-nz"></span></a> <a href="/de/online-agentur/" class="lang-de"><span class="flag-icon flag-icon-ch"></span></a></div>');

             }           

     /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
    if (lang == "de") {
      $('a[href="/"]').attr("href", "/de/online-agentur/");
    }
    if (lang == "en") {
      $('a[href="/"]').attr("href", "/en/online-agency/");
    }

      
      /* SETUP URL REROUTE FOR MATCHING LANGUAGE PAGE */
       var pages = [
      {'de': '/de/', 'en': '/en/'},
      {'de': '/de/online-agentur', 'en': '/en/online-agency/'},
      {'de': '/de/prozess/', 'en': '/en/process/'},
      {'de': '/de/kueber-uns/', 'en': '/en/about/'},
      {'de': '/de/kontakt/', 'en': '/en/contact/'}
    ];
    
    $.each(pages, function(index, page_map){
          if (window.location.pathname === page_map[lang]){
                   if (lang === "de"){
                           $(".language a.lang-de").attr("href", page_map[lang]);
                        $(".language a.lang-en").attr("href", page_map['en']);
                   } else {
                           $(".language a.lang-en").attr("href", page_map[lang]);
                        $(".language a.lang-de").attr("href", page_map['de']);
                   }
          }
             })                                             
  
  });
  
</script>

Link to post
  • 0

edit your code to, I added open script tag

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.6.0/css/flag-icon.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
    window.Squarespace.onInitialize(Y, function(){  
    /* SETUP MULTI-LANGUAGE */
    var defaultLanguage = 'en';
    var lang = location.pathname.split("/")[1];
    var defaultClass = 'lang-'+defaultLanguage+'';
    var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']";
    if (lang == "" || lang.length > 2 ){
      var lang = defaultLanguage;
    }

    /* ADD LANGUAGE CLASSES */
    $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+'');
    $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () {
      var langType = $(this).attr('href').split("/")[1];
      var multiLanguageClass = 'multilanguage lang-' + langType + '';
      if (undefined !== langType && langType.length <= 2) {
        $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass);
      }
    });
    $('nav button').each(function () {
      var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0];
      var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + '';
      if (undefined !== langTypeFolder && langTypeFolder.length <= 2) {
        $(this).addClass(multiLanguageClass);
      }
    });

    /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
    if (lang == "en") {
      $('a[href="/"]').attr("href", "/en/online-agency/");
    }

    /* ADD EXCLUSION NAV ITEMS */
    $('.exclude-me,.exclude-me a').addClass('exclude');
    $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude');

    /* REMOVE OTHER LANGUAGES AND KEEP EXCLUDED ITEMS */
    $('.multilanguage:not(".lang-'+lang+',.exclude")').remove();

    /* SETUP LANGUAGE SWITCHER */
    $('body').prepend('<div class="language"><a href="/en/online-agency" class="lang-en"><span class="flag-icon flag-icon-nz"></span></a> <a href="/de/online-agentur/" class="lang-de"><span class="flag-icon flag-icon-ch"></span></a></div>');

             }           

     /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
    if (lang == "de") {
      $('a[href="/"]').attr("href", "/de/online-agentur/");
    }
    if (lang == "en") {
      $('a[href="/"]').attr("href", "/en/online-agency/");
    }

      
      /* SETUP URL REROUTE FOR MATCHING LANGUAGE PAGE */
       var pages = [
      {'de': '/de/', 'en': '/en/'},
      {'de': '/de/online-agentur', 'en': '/en/online-agency/'},
      {'de': '/de/prozess/', 'en': '/en/process/'},
      {'de': '/de/kueber-uns/', 'en': '/en/about/'},
      {'de': '/de/kontakt/', 'en': '/en/contact/'}
    ];
    
    $.each(pages, function(index, page_map){
          if (window.location.pathname === page_map[lang]){
                   if (lang === "de"){
                           $(".language a.lang-de").attr("href", page_map[lang]);
                        $(".language a.lang-en").attr("href", page_map['en']);
                   } else {
                           $(".language a.lang-en").attr("href", page_map[lang]);
                        $(".language a.lang-de").attr("href", page_map['de']);
                   }
          }
             })                                             
  
  });
  
</script>

 

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...