Can any one help on this basic html javascript css [closed]

I want to create frontend landpage with a simple game soccer penalty for people enjoy!

we have a object ball and goal when people click on ball the ball is moving to goal first click wrong goal second wrong third into goal then the message popup (you are the best).

Please help thank you!

I want new code please help

Shopify cart – limit for gift/free shipping currency issue

I have this shopify store (dawn 12) and I’m using the native currency selector.
I have a custom cart setup where I did a progress bar and amount limit for a free gift to automatically be added after the set amount is surpassed. Nevertheless, I have an issue with the currency selector as the limit is not being converted along with the prices and therefore the value changes. In the attached image you’ll see my cart with a limit supposed to be 900 DKK, which is now 900 euros after I changed the currency.

enter image description here

I’ve tried to pull the rate of the selected currency without luck like this:
const conversionRate = window.Shopify.currency.active === "DKK" ? 1 : window.Shopify.currency.rate;
And also like this with liquid:
{% assign convertedGiftLimit = gift_limit | times: cart.currency.rate %}

Then I contacted Shopify’s support which informed me it was not possible to fetch a currency rate for the selected currency at all. I thought that was quite weird but then tried to avoid it with the use of state.cart.original_total_price; instead which was supposed to return the cart value in the stores base currency. Also without any luck.
All payments are drawn in the same currency (DKK) at check out btw.

So now I’m not sure how to process, I hope I’ve just missed the obvious and some clever mind can point out what I’m doing wrong since this shouldn’t be such a hassle I believe. You can see my code below.

Thanks a million for helping me out!

CONDITIONS FROM CART SECTION

    {% if hasGift %}
    // On load, we need to listen for whenever a customer removes a gift product, and then toggle our global state to prevent re-adding.
    const initRemoveGiftButtons = () => {
        const removeGiftButtons = document.querySelectorAll('.peech-cart-drawer-remove-gift');
        for(const button of removeGiftButtons){
            button.addEventListener('click', () => {
                window.cartHasRemovedGift = true;
                window.sessionStorage.setItem('cartHasRemovedGift', 'true')
            })
        }
    }
    document.addEventListener('DOMContentLoaded', () => {
        initRemoveGiftButtons();
    })

   subscribeToCartStateUpdate(state => {
    const promoVariant = {{ gift_product_variant_id }};
    const promoSubtotal = {{ section.settings.gift_limit }};
  
    
        // If cart state exists and there is no Ajax Cart API request in progress
        if (state.status.cartStateSet && !state.status.requestInProgress) {
            // Add event-listener to support removing
            initRemoveGiftButtons();
            
           let currentSubtotal = state.cart.original_total_price; 

            // Find out if there is a product that was automatically added before
            const autoAddedLineItem = state.cart.items.findIndex( lineItem => { 
                return lineItem.properties?._autoadded === 'Yes' ;
            });
    
            // If there is the automaticaly added product —
            // lets calculate the currentSubtotal without the product
            if ( autoAddedLineItem > -1 ) {
                currentSubtotal -= state.cart.items[autoAddedLineItem].final_line_price;
            }
    
            const hasPromoItem = state.cart.items.filter((item) => item.variant_id == promoVariant);
            // Check if we've previously removed the gift.
            const hasRemovedGift = window.sessionStorage.getItem('cartHasRemovedGift') === 'true' || window.cartHasRemovedGift;

            // Check if cart contains a product found in the exclusion list.
            const excludedProductList = {{ section.settings.excluded_product_list | json }};

            // Build two arrays of product ID's for comparison
            const excludedProductIDs = excludedProductList.map(item => item.id)
            const cartIDs = state.cart.items?.map(item => item.product_id);

            // Check if any cart product id appears in excluded products
            const hasExcludedProduct = cartIDs.some(id => excludedProductIDs.includes(id));

           if (currentSubtotal >= promoSubtotal) {
                if (hasPromoItem.length == 0 && !hasRemovedGift && !hasExcludedProduct) {
                    cartRequestAdd({ 
                        items: [{
                            id: promoVariant,
                            quantity: 1,
                            properties: { "_autoadded": "Yes" }
                        }]  
                    });
                    // Re-set state just in case
                    window.cartHasRemovedGift = false;
                    window.sessionStorage.setItem('cartHasRemovedGift', 'false')
                }

                if(hasPromoItem.length > 0 && hasExcludedProduct){
                    // User already has excluded product, it should be removed.
                    cartRequestChange({ 
                        "line": autoAddedLineItem + 1,
                        "quantity": 0
                    });
                }
            } else {
                if (hasPromoItem.length > 0) {
                    cartRequestChange({ 
                        "line": autoAddedLineItem + 1,
                        "quantity": 0
                    });
                }
            }
        }
    });
    {% endif %}

CONDITIONS FROM CART SNIPPET

{% assign delivery_progress = cart.total_price | times: 1.0 | divided_by: delivery_limit | times: 1.0 | times: 100 | floor %}
{% if delivery_progress >= 100 %}
    {% assign achieved_delivery = true %}
{% endif %}

{% if hasGift %}
    {% assign selectedCurrency = cart.currency.iso_code %}
    {% assign gift_limit = section.settings.gift_limit %}
    
    {% assign convertedGiftLimit = 0 %}
    
    {% if selectedCurrency == 'DKK' %}
        {% assign convertedGiftLimit = gift_limit %}
    {% else %}
        {% assign convertedGiftLimit = gift_limit | times: 1.0 | divided_by: cart.currency.rate %}
    {% endif %}
    
    {% assign gift_progress = cart.total_price | times: 1.0 | divided_by: convertedGiftLimit | times: 1.0 | times: 100 | floor %}

    {% if gift_progress >= 100 %}
        {% assign achieved_gift = true %}
    {% endif %}

    {% comment %} Check if cart items include excluded item, and if so, write text accordingly {% endcomment %}
    
    {% assign cartIds = cart.items | map: 'product_id' %}
    
    {% assign hasExcludedProduct = false %}
    {% for product in excluded_product_list %}
        {% if cartIds contains product.id %}
            {% assign hasExcludedProduct = true %}
            {% break %}
        {% endif %}
    {% endfor %}
{% else %}
    {% assign gift_progress = delivery_progress %}
{% endif %}


<div class="peech-free-shipping">
    {% if achieved_gift and hasExcludedProduct == false %}
        <p style="margin: 0.5rem; font-size: 1.4rem">{{ 'sections.cart.gifts.gift_achieved' | t }}</p>
    {% elsif achieved_delivery %}
        <p style="margin-bottom: 0.25rem; font-size: 1.4rem">{{ 'sections.cart.gifts.free_shipping_achieved' | t }}</p>
        {% if hasGift and hasExcludedProduct == false %}
            {% assign gift_remaining = gift_limit | minus: cart.total_price | money_with_currency %}
            <p style="margin-top: 0; font-size: 1.2rem">{{ 'sections.cart.gifts.gift_remaining_html' | t: gift_remaining: gift_remaining }}</p>
        {% endif %}
    {% else %}
        {% assign delivery_remaining = delivery_limit | minus: cart.total_price | money_with_currency %}
        <p style="font-size: 1.4rem; margin: 0.5rem 0;">{{ 'sections.cart.gifts.free_shipping_remaining_html' | t: delivery_remaining: delivery_remaining }}</p>
    {% endif %}


    {% if hasExcludedProduct %}
        <p style="margin-bottom: 0.25rem; font-size: 1rem">
            {{ 'sections.cart.gifts.cart_includes_excluded_product' | t }}</p>
    {% endif %}

    <div style="margin: 0.5rem  0 1rem 0; width: 100%; background: rgba(0,0,0,0.1); height: 12px; overflow: hidden; border-radius: 999px">
        <span class="free_shipping_progress" style="display: block; background: #487A53; height: 100%; width: {{ gift_progress }}%"></span>
    </div>

Javascript don t output what i intend it to [closed]

function getDetails(zName, zAge, zCountry) {
  function namePattern(zName) {
    return `${zName.slice(0, zName.indexOf(" "))} ${zName.substr(
      zName.indexOf(" "),
      2
    )}`;
    // Write Your Code Here
    // Osama Mohamed => Osama M.
    // Ahmed ali => Ahmed A.
  }
  namePattern();
  function ageWithMessage(zAge) {
    return `your age is ${zAge.parseFloat()}`;
    // Write Your Code Here
    // 38 Is My Age => Your Age Is 38
    // 32 Is The Age => Your Age Is 32
  }
  ageWithMessage();
  function countryTwoLetters(zCountry) {
    return `You live in ${zCountry.slice(0, 2)}`;
    // Write Your Code Here
    // Egypt => You Live In EG
    // Syria => You Live In SY
  }
  countryTwoLetters();
  function fullDetails() {
    console.log(`Hello ${zName}, ${zAge}, ${zCountry}`);
    // Write Your Code Here
  }
  return fullDetails(); // Do Not Edit This
}

console.log(getDetails("Osama Mohamed", "38 Is My Age", "Egypt"));
// Hello Osama M., Your Age Is 38, You Live In EG

console.log(getDetails("Ahmed ali", "32 Is The Age", "Syria"));
// Hello Ahmed A., Your Age Is 32, You Live In SY

I wanted to make the output this using the functions above

// Hello Osama M., Your Age Is 38, You Live In EG
// Hello Ahmed A., Your Age Is 32, You Live In SY
and i dont know why it not working

puppeteer can’t find the helpers of nodejs handlebars

I’m creating a PDF file using puppeteer in NodeJs. I render the template with handlebars and through the complication I pass the variables so that handlebars get them.

The following code is the one I currently have:

  const browser = await puppeteer.launch({
    headless: 'new',
    // `headless: true` (default) enables old Headless;
    // `headless: 'new'` enables new Headless;
    // `headless: false` enables “headful” mode.
  });
  const page = await browser.newPage();

  // Compila la plantilla Handlebars
  const compiledTemplate = handlebars.compile(template);

  // Renderiza la plantilla Handlebars con los datos necesarios
  const html = compiledTemplate({ datos: datos });

  await page.goto('data:text/html,' + encodeURIComponent(html), { waitUntil: 'networkidle0' });

  // Agrega el archivo JavaScript al contexto de la página web
  await page.addScriptTag({ path: __dirname + '/../public/js/plotly-2.20.0.min.js' });
  await page.addScriptTag({ path: __dirname + '/../public/js/GRAPH/PDF/' + nameFilePPV_L + '.js' });
  await page.addScriptTag({ path: __dirname + '/../public/js/GRAPH/PDF/' + nameFilePPV_T + '.js' });
  await page.addScriptTag({ path: __dirname + '/../public/js/GRAPH/PDF/' + nameFilePPV_V + '.js' });
  await page.addScriptTag({ path: __dirname + '/../public/js/GRAPH/PDF/' + nameFileVSUM + '.js' });

  if (SwitchPPV_L === "on") {
    console.log("SwitchPPV_L: " + SwitchPPV_L)
    await page.evaluate(() => {
      setGrafico_ppv_l();
    });
  }

  if (SwitchPPV_T === "on") {
    console.log("SwitchPPV_T: " + SwitchPPV_T)
    await page.evaluate(() => {
      setGrafico_ppv_t();
    });
  }

  if (SwitchPPV_V === "on") {
    console.log("SwitchPPV_V: " + SwitchPPV_V)
    await page.evaluate(() => {
      setGrafico_ppv_v();
    });
  }
  
  if (SwitchVSUMALL === "on") {
    console.log("SwitchVSUMALL: " + SwitchVSUMALL)
    await page.evaluate(() => {
      setGrafico_vsum();
    });
  }

  const pdf = await page.pdf({ format: 'A5', printBackground: true });

  await browser.close();
  fs.promises.unlink(__dirname + '/../public/js/GRAPH/PDF/' + nameFilePPV_L + '.js')
  fs.promises.unlink(__dirname + '/../public/js/GRAPH/PDF/' + nameFilePPV_T + '.js')
  fs.promises.unlink(__dirname + '/../public/js/GRAPH/PDF/' + nameFilePPV_V + '.js')
  fs.promises.unlink(__dirname + '/../public/js/GRAPH/PDF/' + nameFileVSUM + '.js')
  res.contentType('application/pdf');
  res.send(pdf);

The code works, but when I add a conditional in my hbs template, the code throws the following error which indicates that it can’t find the defined helper. How can I access the helpers so that puppeteer can render the hbs template correctly?

Handlebars template

{{#if (test datos.SwitchPPV_L)}}
    <h1>True SwitchPPV_L</h1>
{{else}}
    <h1>False</h1>
{{/if}}

Helper Test

helpers.test = (SwitchPPV_L) => {
    if (SwitchPPV_L === "on") {
        return true
    }else{
        return false
    }
}

LOG:

Error: Missing helper: "test"

Create a Image Editor in Ionic Framework using Capacitor

Currently i have using two plugin but can get expect smoothness.

Plugin 1 :- https://pqina.nl/pintura/

Plugin 2 :- https://img.ly/

Can someone please provide guidance on how to implement image editing features like Instagram’s in an Ionic Framework
project using Capacitor? Any code examples, libraries, or best practices would be greatly appreciated.

Thank you for your help!

I want to Build a Image Editor to Add Text(Change font, size, style, color etc..) on Images in Application Using Capacitor same as like Instagram.

Manually altering history inside a vue.js project

I’m working on a vue.js v3 project, with vue-router.

Routing is fine, not an issue. But I have a sliding panel to display some informations. This sliding panel can be called from different views/routes. And I want to keep the view state (scroll, etc…) when I’m displaying the sliding panel.

For that, this sliding panel is on my App.vue file

<template>
  <router-view></router-view>
  <SlidingPanel v-if="post"/>
</template>

post is stored in a store : when you click on a post, this post object is stored on a store, and the sliding panel is opened.

This works fine

But the natural behavior is to slide back (from the right side of your phone) to close the panel. I did a trick to do so

router.beforeEach((to,from) => {
  if(store.state.post.post) {
    store.commit('post/hide')
    return false;
  }
}

which means : if you’re going back into history with the sliding panel opened, it will cancel your “go back”, and close the panel instead.

This works fine

But if it’s the first time you’re visiting the webapp, opening the sliding panel, your “go back” gesture will go back your browsing history, and you will leave the website. That’s not what I want.

On of my idea will be to add an history element if the from property inside the router.beforeEach() function is empty, and do so every time you open the sliding panel. Do you think it’s a good idea or do you have any recommendation doing something else ?
And I’m struggling adding an element inside my router.history. I tried router.push()or window.history.state but it’s not working as expected (it’s not inside the vue.js history). Do you have an idea ?

CKEditor5: How to integrate a SVG sprite as a widget?

I’m trying to use CKEditor5 here to correctly cast an SVG sprite element and display it as a widget, but unfortunately I’m only partially succeeding.

The HTML element to be cast looks like this:

<svg class="fas fa-backward svgsprite" style="color:red;" fill="currentColor" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
    <use href="/localpath/sprites/solid.svg#backward">
</svg>

Essentially, so far I’ve managed to get the upcast of the elements to the model to work:

enter image description here
enter image description here

The dataDowncast also works as expected:

enter image description here

And the view element also seems to be correct from my point of view:

enter image description here

However, I have the problem that the editingDowncast does not work as I would expect:

enter image description here

On the one hand, the widget cannot be selected and moved, and on the other hand, no SVG is displayed at all (which is the primary point of this question).

The relevant parts of the code I use look like this:

export class IconpackEditing extends Plugin {

  init() {
    this._defineSchema();
    this._defineConverters();
  }

  _defineSchema() {
    const schema = this.editor.model.schema;

    schema.register('svgSprite', {
      allowAttributes: ['class', 'style', 'viewBox', 'fill', 'xmlns'],
      allowWhere: '$text',
      isInline: true,
      isObject: true,
      isLimit: true,
      allowChildren: 'svgSpriteUse',
    });
    schema.register('svgSpriteUse', {
      allowAttributes: ['href'],
      allowIn: 'svgSprite',
      allowEmpty: true,
    });

    this.editor.editing.view.domConverter.inlineObjectElements.push('svgSprite');

    schema.addChildCheck((context, childDefinition) => {
      if (context.endsWith('svgSpriteUse') && childDefinition.name == 'svgSprite') {
        return false;
      }
    });
  }

  /**
   * SVG Sprite converters
   */
  _defineConverters() {
    const conversion = this.editor.conversion;

    conversion.for('upcast').elementToElement({
      view: {
        name: 'use',
        attributes: ['href']
      },
      model: (viewElement, { writer: modelWriter }) => {
        return modelWriter.createElement( 'svgSpriteUse', viewElement.getAttributes());
      },
      converterPriority: 'highest'
    });
    conversion.for('dataDowncast').elementToElement({
      model: 'svgSpriteUse',
      view: (modelElement, { writer }) => {
        return writer.createContainerElement('use', modelElement.getAttributes());
      }
    });
    conversion.for('editingDowncast').elementToElement({
      model: 'svgSpriteUse',
      view: (modelElement, { writer: viewWriter }) => {
        return viewWriter.createContainerElement('use', modelElement.getAttributes());
      }
    });


    conversion.for('upcast').elementToElement({
      view: {
        name: 'svg',
        classes: 'svgsprite'
      },
      model: (viewElement, { writer: modelWriter }) => {
        return modelWriter.createElement('svgSprite', viewElement.getAttributes());
      },
      converterPriority: 'highest'
    });
    conversion.for('dataDowncast').elementToElement({
      model: 'svgSprite',
      view: (modelElement, { writer }) => {
        return writer.createContainerElement('svg', modelElement.getAttributes());
      },
    });
    conversion.for('editingDowncast').elementToElement({
      model: 'svgSprite',
      view: (modelElement, { writer: viewWriter }) => {
        const viewElement = viewWriter.createContainerElement('svg', modelElement.getAttributes());
        viewElement._addClass('ck-widget-svgicon');
        return toWidget(viewElement, viewWriter, { label: 'SVG icon widget' });
      }
    });
  }
}

I have tried all settings for the editingDowncast and also checked if there is something wrong with the paths. But the paths are 100% correct (even if I replaced them in this example with localpath) and in the same document the SVG element can be displayed …but unfortunately not in the CKEditor and I just can’t figure out what I’m doing wrong here.

I would be grateful for any help!

HttpContext Request Files Count is coming zero

I am trying to get picture from user and upload it to a folder in my application. But, my file count is coming out zero in my Web API. Due to this I am unable to upload it to the folder.

I am working in Angular JS along with MVC Web Api Controller

My input control is :

<input type="file" valid-file upload="uploadFile(file)" ng-model="file">  

Directive is as follows:

app.directive('validFile', [function () {
    return {
        require: 'ngModel',
        scope: { format: '@', upload: '&upload' },
        link: function (scope, el, attrs, ngModel) {
            // change event is fired when file is selected
            el.bind('change', function (event) {
                console.log(event.target.files[0]);
                scope.upload({ file: event.target.files[0] });
                scope.$apply(function () {
                    ngModel.$setViewValue(el.val());
                    ngModel.$render();
                });
            })
        }
    }
}]);

Controller method is as follows:

var PromiseData = UserService.uploadProfilePicture(file);
        PromiseData.then(function (Response) {
            alertify.alert('Picture Uploaded Sucessfully');
            $scope.ProfilePicturePath = response.data;

        }, function (Error) {
            alertify.alert('Some issue occurred while saving picture');
        });

Service method to call Web Api as follows:

this.uploadProfilePicture = function (ProfilePicture) {
        var formData = new FormData();
        formData.append('file', ProfilePicture);
        var request = $http({
            method: "post",
            url: "/api/ImageUploadApi",
            data: formData,
            headers: { "Content-Type":false }
        });
        return request;
    };

Image upload Api to upload file is as follows where HttpContext.Current.Request.Files count is coming Zero

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace UAECensus.Controllers
{
    public class ImageUploadApiController : ApiController
    {
        [HttpPost]
        public IHttpActionResult Post()
        {
            var path = System.Web.Hosting.HostingEnvironment.MapPath("~/UserProfilePic/");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            HttpPostedFile postedFile = HttpContext.Current.Request.Files[0];

            //Fetch the File Name.
            string fileName = Path.GetFileName(postedFile.FileName);

            //Save the File.
            postedFile.SaveAs(path + fileName);
            return Content(HttpStatusCode.OK, fileName);
        }

    }
}

Also I have added following line in WebApiConfig.cs in AppStart folder

config.Formatters.XmlFormatter.SupportedMediaTypes.Add(new System.Net.Http.Headers.MediaTypeHeaderValue("multipart/form-data"));

I am not getting my problem. Please guide

babel not trans compiling the files inside node_modules even with babel.config.js

I was getting this error

SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)

So I configured .babelrc with

{
    "presets": ["@babel/preset-env"],
    
}

While this resolved the issue in all the files, it couldn’t the ones which are inside node_modules

So I read some of the answers and it was recommended to change from .babelrc to babel.config.js to include all the directory including node_modules.

so I changed it to folowing:

module.exports = {
    presets: ["@babel/preset-env"],
    
}; 

However the issue still persists.

intersectsMesh Babylon.js

I am creating a project in which it is necessary to return an object to certain coordinates when it intersects with another object

Here’s the source code, what’s wrong?

Thanks!

`const createScene = () => {
const scene = new BABYLON.Scene(engine);

const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 3, new BABYLON.Vector3(0, 0, 0));
camera.attachControl(canvas, true);

const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0));
const box = BABYLON.MeshBuilder.CreateBox("box", {});

pointerDragBehavior2 = new BABYLON.PointerDragBehavior({ dragPlaneNormal: new BABYLON.Vector3(0, 1, 0) });
pointerDragBehavior2.useObjectOrientationForDragging = false;

box.addBehavior(pointerDragBehavior2);


const sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {});
sphere.position.x = 5;

if (box.intersectsMesh(sphere, false)) {
    box.position.x = 0;
    box.position.y = 0;
    box.position.z = 0;
}

return scene;

}`

I tried to do it with this code, but it didn’t work out, what am I doing wrong?

Filenames without paths from the Location Property in Script

I Need to make this Javascript not output the entire path for the file location, only the filename is needed in the resulting file. What is the best way to go about this? Thanks

(function () {
   var doc = app.activeDocument;
   var myBaseName = doc.name;
   var familyNames = [];
   var i;
   var names = [];
   var styleNames = [];
   var fontTypes = [];
   
   if (/InDesign/.test(app.name)) {
       familyNames = app.activeDocument.fonts.everyItem().fontFamily;
       styleNames = app.activeDocument.fonts.everyItem().fontStyleName;
       fileName = app.activeDocument.fonts.everyItem().location;
       fontTypes = app.activeDocument.fonts.everyItem().fontType;
       fontNames = app.activeDocument.fonts.everyItem().name;

       for (i = 0; i < fontNames.length; i++)

            {names.push([familyNames[i] + " " + styleNames[i], fileName[i], fontTypes[i]]);}
       writeCsv("InDesign Document", names);
   } 

   function writeCsv(program, names) {
       var file;
       var i;
       file = new File("~/Desktop/" + myBaseName + "_fonts.csv");
       file.encoding = "UTF-8";
       file.open("w");
       file.writeln("Font name,File name,Font type");
       names.sort();
       for (i = 0; i < names.length; i++) {
           file.writeln(names[i].join(",") + "r");
       }
       file.close();
       alert("Output " + File.decode(file.fullName));
   }

})();

Tried a few different methods, LastIndexOf(‘/’)

The Audio playback notification is still visible when the playback stops

I’m using [email protected]. When I closed the application, The audio stopped but the playback notification was still visible.

Here is my track player setup code in index.js file.

const trackSetup = async () => await TrackPlayer.setupPlayer({
waitForBuffer: false}).then( async () => {
await TrackPlayer.updateOptions({
  // stoppingAppPausesPlayback: true,
  android: {
    appKilledPlaybackBehavior:
      AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification,
  },
  notificationCapabilities: [
    Capability.Play,
    Capability.Pause,
    Capability.JumpBackward,
    Capability.JumpForward,
    Capability.SeekTo,
  ],
  capabilities: [
    Capability.Play,
    Capability.Pause,
    Capability.JumpBackward,
    Capability.JumpForward,
    Capability.SeekTo,
  ],
  compactCapabilities: [Capability.Play, Capability.Pause],
});
console.log(AppState.currentState, 'Track Player Setup...');});

Kindly help/guide me to fix this issue. Every help is appreciated.

Add delay to the dissapearing of the text

i just created a custom loafding animatiuon with js but i cannot figure out how to make it be delayed (i want the text to fill and then have a 1-2 sec delay so that people can see what is going on on the screen)

I have the code here:

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.3/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/CustomEase.min.js"></script>

<script>

// Pre-loader
// Variables
// Custom ease
let customEase =
  "M0,0,C0,0,0.13,0.34,0.238,0.442,0.305,0.506,0.322,0.514,0.396,0.54,0.478,0.568,0.468,0.56,0.522,0.584,0.572,0.606,0.61,0.719,0.714,0.826,0.798,0.912,1,1,1,1";
// Counter start
let counter = {
  value: 1924
};
// Duration
let loaderDuration = 4;

// Duration, and counter start - if not a first time visit in this tab
if (sessionStorage.getItem("visited") !== null) {
  loaderDuration = 3;
  counter = {
    value: 1924
  };
}
sessionStorage.setItem("visited", "true");

function updateLoaderText() {
  let progress = Math.round(counter.value);
  $(".page-loader_text").text(progress);
}
function endLoaderAnimation() {
  $(".page-loader_trigger").click();
}

let tl = gsap.timeline({
  onComplete: endLoaderAnimation
});
tl.to(counter, {
  value: 2024,
  onUpdate: updateLoaderText,
  duration: loaderDuration,
  ease: CustomEase.create("custom", customEase)
});
tl.to(".page-loader_text-fill", {
    height: "150%",
    duration: loaderDuration,
    ease: CustomEase.create("custom", customEase)
}, 0);

</script>`your text`

Does anybody know where i should add the timeout function?

I have no clue what do do.

Error during getRange() for a tab in app script (Exception: Cliquez ici et saisissez une des valeurs de la plage)

I have a problem when i when to get the range of a tab in the folowing code. When i=4, regardless of the tab i want to get, i have this error : “Exception: Cliquez ici et saisissez une des valeurs de la plage Ajouter date HT.gs:35” translated by “Exception: Click here and enter one of the range values Ajouter date HT.gs:35”

I tried in first time the getDataRange() then i tried with getLastRow and getLastColumn with a getRange() i had the same problem and now i tried the folowing code but i have the same problem.

I don’t understand where come from the problem and chatGPT also.

The variables are in french but i translated the comments

function ajouter_date_HT() {
  // The purpose of this code is to add the HT and nominal dates in the collab tabs according to certain conditions

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var onglets = ss.getSheets(); //We recover the tabs of the file
  var nom_onglets = [];
  var onglets_a_retirer = ["Param", "HT", "Compilation", "FLArchivDe", "ANDON", "Liste", "Dérogations", "Base Formules", "ImportedData"]; //We specify the tabs we want to remove
  var date = new Date();
  date.toLocaleDateString("fr");
  var lignes_changees = "";
  var formule_prio = '=IF(IFERROR(VLOOKUP("/!";F2;1;0)>0);"HOT Topic";IF(ISBLANK(N2);"";IFERROR(VLOOKUP(N2;ANDON!A:F;6;FALSE); "Nominal")))';
  var formule_supplier = "=IF(E2="";"";VLOOKUP(E2;'Base Formules'!A$2:B$241;2;FALSE))";
  var formule_appareil = '=IF(ISBLANK(N2);"";IFNA(VLOOKUP(LEFT(N2;1);'Base Formules'!L$2:M$16;2;FALSE);IF(COUNTIF('Base Formules'!L:M; LEFT(N2;2)*1)=0;"Divers";VLOOKUP(LEFT(N2;2)*1;'Base Formules'!L$2:M$16;2;FALSE))))';
  var formule_BE = '=IF(ISBLANK(O2);"";IFERROR(IF(ISNUMBER(VALUE(LEFT(O2;1)));IFERROR(VLOOKUP(CONCATENATE(MID(O2;5;2);"-";MID(O2;1;3));IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ZgkOBXbnZE3ZCMVzdAjsvsBTSZgplpnkkATOHb4TeNE/edit#gid=1697538978";"BNAé!$A$2:$H$500");8;FALSE);VLOOKUP(CONCATENATE(MID(O2;5;2);"-");IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ZgkOBXbnZE3ZCMVzdAjsvsBTSZgplpnkkATOHb4TeNE/edit#gid=1697538978";"BNAé!$A$2:$H$500");8;FALSE));IFERROR(VLOOKUP(CONCATENATE(MID(O2;2;3);"-";MID(O2;1;1));IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ZgkOBXbnZE3ZCMVzdAjsvsBTSZgplpnkkATOHb4TeNE/edit#gid=1697538978";"ATA!$A$2:$H$500");6;FALSE);IFERROR(VLOOKUP(MID(O2;2;3);IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ZgkOBXbnZE3ZCMVzdAjsvsBTSZgplpnkkATOHb4TeNE/edit#gid=1697538978";"ATA!$A$2:$H$500");6;FALSE);VLOOKUP(MID(O2;2;2);IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ZgkOBXbnZE3ZCMVzdAjsvsBTSZgplpnkkATOHb4TeNE/edit#gid=1697538978";"ATA!$A$2:$H$500");6;FALSE))));"BE pas trouvé"))';
  var formule_NC_mere = '=IF(D2<>"";"";IFERROR(IF(INDEX(ImportedData!M:M; MATCH(E2&"-"&O2&"-"&W2&"-"&X2; ImportedData!AP:AP; 0)) = L2; ""; INDEX(ImportedData!M:M; MATCH(E2&"-"&O2&"-"&W2&"-"&X2; ImportedData!AP:AP; 0))); "Pas de NC mère"))';
  var formule_drive = '=IF(A2="Nominal"; ""; ' + 'IF(ISBLANK(L2); ""; ' + 'IFERROR(IF(COUNTIF(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VTyKEcgNiHfj3KUOAWqn_qIohGtWt4JOUMIarzo-Hkk/edit#gid=0"; "HT follow-up!E:E"); L2)>=1; "OUI"; "NON"))))'+ '';
  var lien_fichier_BE = '=HYPERLINK("' + "https://docs.google.com/spreadsheets/d/1ZgkOBXbnZE3ZCMVzdAjsvsBTSZgplpnkkATOHb4TeNE/edit#gid=0" + '"; "' + "Responsable action NOM" + '")';

  onglets.forEach(function (sheet) { //We get only the name of the tabs that we put in "nom_onglets"
    nom_onglets.push(sheet.getName());
  });
  
  for (let i = 0; i <= onglets_a_retirer.length; i++){ //We loop for each tab we want to remove and we look for it in the table. If so, we remove it from the list.

    let index = nom_onglets.indexOf(onglets_a_retirer[i]);
    if (index > -1) { //Seulement si on trouve l'élément
      nom_onglets.splice(index, 1);
    };

  };

  for (let i = 0; i < nom_onglets.length; i++){ //We loop on the tabs
    let onglet_collab = ss.getSheetByName(nom_onglets[i]);
    Logger.log(nom_onglets[i]);
    let numRows = onglet_collab.getRange("A:A").getValues().filter(String).length;
    let numCols = onglet_collab.getLastColumn();
    let onglet_data_range = onglet_collab.getRange(1, 1, numRows, numCols);
    let onglet_boucle = onglet_data_range.getValues();
    
    for (let j = 1; j < onglet_boucle.length; j++){ //We loop on each rows of the tabs
      if(onglet_boucle[j][3] == "" && onglet_boucle[j][32] == "" && onglet_boucle[j][34] != "DA Refused"){ //If it’s not a CO or a closure or a refusal then we continue

        let prio = onglet_boucle[j][0]; //We get the prio of the row
        let date_HT = onglet_boucle[j][1]; //We get the HT date of the row
        let date_nominale = onglet_boucle[j][2]; //We get the nominal date of the row



        if (prio == "" && date_HT == "" && date_nominale == ""){ //If it’s an empty row, we do nothing  
        
        } else if (prio != "Nominal" && date_HT != "" && date_nominale != ""){ //If it is an HT row with HT date and nominal date, the nominal date is deleted
          onglet_boucle[j].splice(2, 1, "");
          lignes_changees += "- onglet " + nom_onglets[i] + " ligne " + (j + 1) + "n";
        } else if (prio != "Nominal" && date_HT == ""){ //If it is a HT row without HT date, we put the date
          onglet_boucle[j].splice(1, 1, date);
          lignes_changees += "- onglet " + nom_onglets[i] + " ligne " + (j + 1) + "n";
        } else if (prio == "Nominal" && date_HT != "" && date_nominale == ""){ //If it is a nominal row with HT date, a nominal date is set
          onglet_boucle[j].splice(2, 1, date);
          lignes_changees += "- onglet " + nom_onglets[i] + " ligne " + (j + 1) + "n";
        }
      }
    }


    Logger.log(onglet_boucle.length + " " + onglet_boucle[0].length);
    onglet_collab.getRange(1, 1, onglet_boucle.length, onglet_boucle[0].length).setValues(onglet_boucle);
    
    if(nom_onglets[i] != "Damien" && nom_onglets[i] != "Christophe"){ //We do not apply this formula for Damien and Christophe tabs
      onglet_collab.getRange("U2:U").setFormula(formule_BE);
    }

    onglet_collab.getRange("A2:A").setFormula(formule_prio);
    onglet_collab.getRange("F2:F").setFormula(formule_supplier);
    onglet_collab.getRange("P2:P").setFormula(formule_appareil);
    onglet_collab.getRange("AA2:AA").setFormula(formule_NC_mere);
    onglet_collab.getRange("AN2:AN").setFormula(formule_drive);
    onglet_collab.getRange("U1").setFormula(lien_fichier_BE);
    
  }

  Logger.log(lignes_changees);

}