Skip to content

Instantly share code, notes, and snippets.

View iamrobert's full-sized avatar

Robert Stark iamrobert

View GitHub Profile
@iamrobert
iamrobert / new-window.js
Created March 6, 2023 11:47
Open LInk in new window via JS
//4. SET EXTERNAL LINKS
function setRelAttribute() {
var elems = document.body.querySelectorAll('.mainbody a:not([class^="glightbox"])');
var l = window.location.hostname;
var regex = new RegExp('^https?:\/\/' + l.replace(/\./g, '\\.') + '(\/.*)*$|^\/.*$');
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
var isInternal = regex.test(elem.href);
@iamrobert
iamrobert / bad.html
Created December 20, 2022 11:39
Bad Html Example to clean on paste
<h3 class="class">Some supported heading</h3>
<h6>non supported heading</h6>
<style type="text/css">
font {
font-family: arial;
font-size: 140%;
}
</style>
<h1><p>PASTE CHECK</p></h1>
<h1><a href="#">PASTE CHECK</a></p></h1>
@iamrobert
iamrobert / demo.html
Created December 17, 2022 14:05
LT Broswer can't read :is()
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
:is(.green) {
color: green;
background:lime;
@iamrobert
iamrobert / locomotive-gists.js
Last active December 17, 2022 10:23
Locomotive JS gists - #anchor scrolls and tabs
/* + LOCOMOTIVE ANCHORS
https://github.com/locomotivemtl/locomotive-scroll/issues/175#issuecomment-1082541029
======================================================================*/
const anchorLinks = document.querySelectorAll('.mainbody a[href^=\\#]:not(.no-loco):not([href$=\\#])');
anchorLinks.forEach((anchorLink) => {
let hashval = anchorLink.getAttribute('href');
let target = document.querySelector(hashval);
anchorLink.addEventListener('click', (e) => {
/*
* Accessible AccordionTabs, by Matthias Ott (@m_ott)
*
* Based on the work of @stowball (https://codepen.io/stowball/pen/xVWwWe)
*
*/
(function () {
'use strict';
@iamrobert
iamrobert / item-slider.php
Created October 2, 2022 14:19
FLEXIContent slider for youtube or image
<?php
// No direct access
defined( '_JEXEC' )or die( 'Restricted access' );
// GET URL
//function url(){
// return sprintf(
// "%s://%s",
@iamrobert
iamrobert / item-gallery.php
Last active September 27, 2022 07:59
FLEXIContent item.php
<?php
defined( '_JEXEC' )or die( 'Restricted access' );
use Joomla\ String\ StringHelper;
/* + ACCORDION ITEM > XML FIELDS
======================================================================*/
$pillar = FlexicontentFields::getFieldDisplay( $item, 'investor' );
@iamrobert
iamrobert / app.navbar.js
Created April 13, 2022 08:11
NAVBAR WITH SCROLL
app.navbar = {
init: function () {
/* + 1. Navigation Bar Height & Header-Shiv (Plus )
======================================================================*/
var root = document.documentElement;
function navBarHeight() {
@iamrobert
iamrobert / anime=js-external.html
Last active April 1, 2022 17:00
anime.js external SVG file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Inline Anime SVG</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* + SVG ANIMATION (anime.js)
======================================================================*/