Action

Instagram Hashtag Info

Last update over 5 years ago - Unlisted

Steps

  • script

    //Number of allowed hash tags
    const limitHash = 30;
    
    //Count hash tag marker occurrences
    let countHash = (draft.content.match(/#/g) || []).length;
    
    //Build a response message and display it
    let strMsg = "You are using " + countHash + " hash tags in your post.\n\n";
    if(countHash > limitHash)
    {
        strMsg += "WARNING: You are using " + (countHash - limitHash) + pluralise(countHash - limitHash, " hash tag") + " over the limit of " + limitHash + ".";
    }
    else
    {
        if(limitHash > countHash)
        {
           strMsg += "You can use another " + (limitHash - countHash) + pluralise (limitHash - countHash, " hash tag") + " before you hit the limit of " + limitHash + ".";
        }
        else
        {
            strMsg += "Don't add any more hash tags. You are on the limit of " + limitHash + pluralise(limitHash, " hash tag") + "."
        }
    }
    alert(strMsg);
    
    //Add an s if not singular
    function pluralise(p_intVal, p_strText)
    {
        if (p_intVal == 1)
        {
            return p_strText;
        }
        else
        {
            return p_strText + "s";
        }
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.