View svg-replace.js
// Replace all SVG images with inline SVG
$('img.svg, #main_logo').each(function(){
var $img = $(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
$.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
View map-midpoint.js
function getMidpoint(point1, point2) {
if (typeof(Number.prototype.toRad) === "undefined") {
Number.prototype.toRad = function() {
return this * Math.PI / 180;
}
}
if (typeof(Number.prototype.toDeg) === "undefined") {
Number.prototype.toDeg = function() {
return this * 180 / Math.PI;
View page-templater.php
<?php
/**
* Page Template main class
*/
class PageTemplater {
/**
* A reference to an instance of this class.
*/
View scrollbar_width.js
function get_scroll_bar_width() {
var $outer = $( '<div>' ).css( {visibility: 'hidden', width: 100, overflow: 'scroll'} ).appendTo( 'body' ),
width_with_scroll = $( '<div>' ).css( {width: '100%'} ).appendTo( $outer ).outerWidth();
$outer.remove();
return 100 - width_with_scroll;
}
View .eslintrc
{
"root": true,
"globals": {
"_": false,
"$": false,
"Backbone": false,
"JSON": false,
"jQuery": false,
"wp": false
},
View dashboard-widget.php
<?php
/**
* Dashboard widget
*
* @package WordPress
* @version 1.0.0
* @author Denis Žoljom <denis.zoljom@gmail.com>
* @license GNU General Public License v2 or later
* @link http://madebydenis.com/
* @since 1.0.0
View expanded_html_tags.php
if ( ! function_exists( 'html_allowed_tags' ) ) {
/**
* Allowed tags function for wp_kses()
*
* @return array Array of allowed HTML tags
* @since 1.0.0
*/
function html_allowed_tags() {
return array(
'a' => array(
View embedd.php
<?php
/**
* Contains the post embed base template
*
* When a post is embedded in an iframe, this file is used to create the output
* if the active theme does not include an embed.php template.
*
* @package madebydenis
* @subpackage oEmbed
* @since 4.4.0
View functions.php
<?php
/**
* Your theme functions and definitions
*
* Set up the theme and provides some helper functions, which are used in the
* theme as custom template tags. Others are attached to action and filter
* hooks in WordPress to change core functionality.
*
* @package WordPress
* @subpackage yourtheme
View test.js
// iOS double click issue on menu
$('nav > ul > li a').on('touchend', function(event) {
window.location.href = $(this).attr('href');
});
// Doubleclick prevent; from http://stackoverflow.com/a/28566136/629127
function my_function(e) {
const $this = $(e.currentTarget);
e.preventDefault();