Skip to content

Instantly share code, notes, and snippets.

View acusti's full-sized avatar
Black Lives Matter

Andrew Patton acusti

Black Lives Matter
View GitHub Profile
@acusti
acusti / dropdown-touch.js
Last active July 11, 2017 18:00
Plain vanilla JS with no dependencies to add touch device support for drop down menus (nested unordered list style). CSS selectors to display nested `<ul>` should look like: `body.no-touch ul.menu > li:hover > ul, ul.menu > li.tapped > ul { display: block; }`
(function(doc) {
// Add touch device support for dropdown menu
if (('addEventListener' in doc) && ('querySelectorAll' in doc) && (('ontouchstart' in window) || ('onmsgesturechange' in window))) {
var menu_item_selector = '.the-menu > div > ul > li',
menu_items = doc.querySelectorAll(menu_item_selector),
touchStart;
// Set up touch start handler
touchStart = function() {
if (this.className.indexOf(' tapped') > -1) {
@acusti
acusti / functions.php
Last active December 12, 2015 08:09
WordPress: Add custom TinyMCE button that wraps selection in given tag with a couple extra functions from within your theme’s functions.php
<?php
/**
* Filter TinyMCE wysiwig editor to include custom button
*
* @since MyTheme 1.0
*
* @param $buttons TinyMCE button array
* @return $buttons TinyMCE button array
*/
@acusti
acusti / Shopp-fr_FR.po
Created July 26, 2011 03:10
Shopp .po language file French translation
# Copyright (C) 2010 Shopp
# This file is distributed under the same license as the Shopp package.
msgid ""
msgstr ""
"Project-Id-Version: Shopp 1.2dev\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/shopp\n"
"POT-Creation-Date: 2011-06-01 16:14:53+00:00\n"
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"