It's as simple as url.match(/\/\/(.[^/]+)/)[1]. Requires the double slash before the domain part, but not a slash after it.
Tag Archives: JavaScript
New in JavaScript ES6
24-Jul-18ES6 introduces new operators and concepts, like spread operator and Sets. Introduction to ES6+
Tim's blog uses DOMTabĀ for tabbing the top lists of popular posts. Tabs are populated with WordPress Popular Posts plugin and some manual lists as well. Remember to allow shortcodes in sidebar. Then add a text widget with something like: <div class="domtab"> <ul class="domtabs"> <li class="active"><a class="domtab1" href="#t1" style="cursor:pointer;">Current hits</a></li> <li><a class="domtab2" href="#t2" style="cursor:pointer;">All time</a></li> <li><a […]
I needed a slideshow that would load (in a way, asynchronously) after the page has been loaded and would show something without JavaScript. This solution requires jQuery and jQuery Cycle plugin (lite version will do). <div id="slideshow"> <img src="default-image.jpg" alt="" /><!--defaults to this image without javascript --> </div> <script type="text/javascript"> $(document).ready(function() { //// random slides […]
JavaScript to Footer in WordPress
20-Jan-10Want to move that jQuery and other js references from header to footer? Try JavaScript to Footer plugin.