Override follow label on LinkedIn Follow button - html

I'm using Linkedin Follow Company plugin
and I jave defined the language (Danish) by doing this
<script src="https://platform.linkedin.com/in.js" type="text/javascript"> lang: da_DK</script>
<script type="IN/FollowCompany" data-id="1337" data-counter="bottom"></script>
But it can't output the "Ø" in Følg, but instead outputs a weird character:
Anyone know if the label is overridable somehow or could provide a solution?

Related

A method to get specific exports when using <script src="">

I'm making a site with Preact & Tailwind. In the code here (I know it doesn't have head, body, e.t,c but that isn't relevant to the code):
<script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/preact/10.11.2/preact.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/htm/3.1.1/htm.js"></script>
<script>
htm.bind(h)
let component = htm`<p>Hello World</p>`
</script>
htm and h are parts of the Preact and HTM cdn. How do I get htm and h from the preact/htm cdns?
I don't want to use a node_modules, as i want it to be a copypastable template html to use anywhere, like WordPress, replit, codepen, e.t.c. I also don't want to use as the way my code is setup it would look weird and bad to read.
Adding a dependency (or dependencies) via <script> adds those to the global scope. h, in the example above, is undefined as you have not specified where it comes from.
<script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/preact/10.11.2/preact.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/htm/3.1.1/htm.js"></script>
<script>
let html = htm.bind(preact.h)
let component = html`<p>Hello World</p>`
</script>
(Adjusted code, as htm.bind alone will not work. Need to assign & use the result).
This, however, is less than ideal in the modern age of ESM. Messing with globals is just rather unnecessary. Instead, use the following:
<script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
<script type="module">
import { h } from 'https://cdn.skypack.dev/preact';
import htm from 'https://cdn.skypack.dev/htm';
let html = htm.bind(h);
let component = html`<p>Hello World</p>`;
</script>
Or, even better yet, use htm/preact export to skip manually binding altogether:
<script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
<script type="module">
import { html } from 'https://cdn.skypack.dev/htm/preact';
let component = html`<p>Hello World</p>`;
</script>
Unpkg has a number of issues (very difficult to fix, if not impossible. Not a criticism, unpkg was built in a different time) regarding ESM usage, specifically for Preact, resolving package.json "exports" and sometimes duping the Preact instance. This is an issue for hooks, as they require a singleton by design. This is why I'd recommend Skypack or esm.sh. They're built for ESM and work brilliantly.

URL to check if IP is in the EU

Does anyone know if there's a service to check if an IP address is in the EU? I'm trying to implement a cookie notification on my website but I only want to show it if it's required by law.
I'm trying to implement this using AMP, and it gives the option to use a URL to check if the notification should be displayed. I know this is probably a long shot, but it needs to return a result like this: (based on the URL the request came from).
{
"showNotification":true
}
I'll probably just end up creating something, just wanted to check on the off chance that someone already did
I just figured out how to do this with amp-geo - I thought I'd share the answer in case anyone else came across it:
Include these JS files:
<script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>
<script async custom-element="amp-geo" src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"></script>
Include this code:
<amp-geo layout="nodisplay">
<script type="application/json">
{
"ISOCountryGroups": {
"ineu": ["al","ad","at","az","by","be","ba","bg","hr","cy","cz","dk","ee","fi","fr","ge","de","gr","hu","is","ie", "it","kz","xk","lv","li","lt","lu","mk","mt","md","mc","me","nl","no","pl","pt","ro","ru","sm","rs","sk", "si","es","se","ch","tr","ua","gb","va"]
}
}
</script>
</amp-geo>
<amp-user-notification id="cookie-notif" layout="nodisplay" data-show-if-geo="ineu">
<div>
This site uses third-party cookies, learn more or <a on="tap:cookie-notif.dismiss" class="ampstart-btn caps ml1">accept</a>
</div>
</amp-user-notification>

Change <Script> Structure

I need to insert a piece of code in my website. The code is to connect my website to MailChimp:
<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/0dc30c560570fa73fdd90b4ec/2cfddd4d9fb2316dbdb3b3c48.js");</script>
The problem is that my website platform just let me add code that starts with <script> and ends with </script>:
https://i.stack.imgur.com/Lyl7A.png
Is there a way to change the code structure to start with <script> , and then add the id="mcjs"?
You can write a <script> that uses document.write and adds the MailChimp script.
<script>
document.write('<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/0dc30c560570fa73fdd90b4ec/2cfddd4d9fb2316dbdb3b3c48.js");<\/script>')
</script>

Pinterest profile widget is not working all the time

I added a Pinterest profile widget to my website the way I usually do it when building a website. Normally it works fine but for some strange reason this time sometimes it shows and sometimes it doesn't... This is the website I'm talking about: http://bav.kadushimarketing.com/index4.php
This is the code I added: <a data-pin-do="embedUser" href="http://www.pinterest.com/bonaireartvilla/" data-pin-scale-width="65" data-pin-board-width="230">Bonaire Art Villas's profile on Pinterest</a>
And this is the script I added:
<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>
I have a lot of other scripts on this website. Is it possible that these scripts conflict with each other? Is there a way to check?
In my case the Pinterest widget didn't load itself if I had a "display:none" style on a parent div-element during the pinit.js initialisation. When I removed that style from the parent, the widget finally replaced the a-tag with a bunch of spans, containing the widget data.
Very strange behaviour, but there's a solution...
Add this line for the widget
<a data-pin-do="embedUser" data-pin-board-width="400" data-pin-scale-height="240" data-pin-scale-width="80" href="https://www.pinterest.co.uk/jojomamanbebe/"></a>
Add these two lines before the closing Body tag
<script type="text/javascript" async defer src="https://assets.pinterest.com/js/pinit.js"></script>
<script type="text/javascript" async defer src="https://assets.pinterest.com/js/pinit_main.js"></script>
I included a very simple "show element on click" jQuery script that conflicted with the Pinterest script.
You must put the tag of Pinterest at the end of site code, just above the closing BODY tag.
Add these two js file in head section
<script type="text/javascript" async defer src="js/pinit.js"></script>
<script type="text/javascript" async defer src="js/pinit_main.js"></script>
Save files from here:
http://assets.pinterest.com/js/pinit.js
http://assets.pinterest.com/js/pinit_main.js
This will work 101%
Add this code just before your closing </body> tag:
<script type="text/javascript">
(function(d){
var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
p.type = 'text/javascript';
p.async = true;
p.src = '//assets.pinterest.com/js/pinit.js';
f.parentNode.insertBefore(p, f);
}(document));
</script>
I add to the widget link style="display: block !important"
and is all working now
This rarely works for me, and I'm not doing anything other than what's spelled out by the Pinterest widget page. In the past I've had to resort to some extremely hacky approaches, like using jQuery's .one() binding function to attach the pinit.js code to the page when a particular element is clicked.
UPDATE: Ugh, my bad. (:P) I was trying to reference a profile for inclusion within the board widget -- unworkable. Switching to the profile widget helped tremendously. I still had a little trouble getting the widget to show up on certain devices, but I did get it going.

How Can I Create a button that links to multiple websites using this HTML outline?

I just wanted to know how I can create a button that can take a person to multiple websites in a random order when it is clicked each time. I plan on using this button for a toolbar that I'm planning to create, and the outline that is provided for the HTML component looks like this:
<html>
<head>
<!--
Uncomment out the below script reference as needed. For more information on using the API, please consult http://www.conduit.com/Developers/overview.aspx
<script language="JavaScript" src="http://api.conduit.com/BrowserCompApi.js"></script>
-->
<style type= "text/css">
<!--
BODY {margin-left:0; margin-right:0; margin-top:0; margin-bottom:0;
width:100%;height:100%;overflow:hidden;background-color:threedface;}
-->
</style>
</head>
<body>
<!-- ENTER YOUR HTML HERE -->
</body>
</html>
Is there any way that I can do this by using this outline? Thanks in advance.
As suggested by others, simply make a button click call a function that picks a random site from an array. Here is an explanation on how to pick a random element from a Javascript array.
Example implementation:
<script type="text/javascript">
var websites = ["http://google.com", "http://reddit.com", "http://stackoverflow.com"];
function randomWebsite() {
var website = websites[Math.floor(Math.random()*websites.length)];
window.location = website;
}
</script>
<button type="button" onclick="randomWebsite();">Random website</button>
I'm not going to write the script for you but you'd want to use javascript to do this. Use the random function and assign your website urls to an appropriate number.
Example:
if you had three total websites then you'd do the random function and assign 0-.33 website 1, .34 - .66 website2, and .67 - 1 website 3.
You need Javascript for that.
You can have a list of websites.
You can get the website you will go to, when the button is clicked, by using the random function in javascript.
Here is the example when using an array, Getting a random value from a JavaScript array
Hope it helps.
We shouldn't give you any code, as you didn't provide anything. But your algorithm should follow what I mentioned.
I think you need javascript to do this,
Take a look on this page maybe this can help you
http://ozirock.hubpages.com/hub/How-to-make-a-Random-Page-button-for-your-website