Spf js - a JavaScript management plugin for Textpattern

Related tags

Miscellaneous spf_js
Overview

spf_js

I’m no longer able to develop this plugin due to ill health. If anyone would like to take over, message me, and I’ll transfer the source.

JavaScript management plugin for Textpattern.

Create, edit and delete scripts in Textpattern admin and export on save to external files.

REQUIRES: Texpattern 4.5.1 and PHP 5.

Please read the instructions and notes below before use.

A combination of two previously-released plugins: stm_javascript by Stanislav Müller and rvm_css by Ruud van Melick. Thanks to the original authors and to Jukka (Gocom) and Stef (Bloke) for invaluable feedback.

Features include exporting scripts as files to a directory, optional “type” attribute type="text/javascript" and changing the tag argument from n= to name= to bring it in line with default css syntax.

Re-written for Textpattern 4.7*

For Textpattern 4.4.1 and below use this version.

DOWNLOAD

Instructions:

  1. Create a directory for the static JavaScript files in the root of your textpattern installation. You should make sure that PHP is able to write to that directory.
  2. Visit the Advanced Preferences (Admin > Preferences > Advanced) and make sure the “JavaScript directory” preference contains the directory you created in step 1 (by default ‘js’). This path is relative path to the directory of your root Textpattern installation.
  3. Activate this plugin.
  4. Go to Presentation > JavaScript and create JavaScripts you’d like to embed within your page templates.
  5. JavaScript files are stored in the database (for easy management and editing) and, on save, exported to a directory in your website where they can be referenced (as external JavaScript) with the tag below.

Tags:

<txp:spf_js /> (embeds the default JavaScript file)

<txp:spf_js name="myscript" /> (embeds the JavaScript file named "myscript")

HTML output:

<script src="http://mysite.com/js/myscript.js"></script>

“type” attribute

By default the plugin outputs a script tag without the ""type" attribute":http://www.w3schools.com/html5/tag_script.asp (required in XHTML/HTML4 but optional in HTML5).

To include a “type” attribute just use the type="1" argument:

<txp:spf_js name="myscript" type="1" />

Outputs:

<script type="text/javascript" src="http://mysite.com/js/myscript.js"></script>

Notes:

  1. Don’t use non-alphanumeric characters in script names (if you try to they’ll be stripped).
  2. The plugin will convert your script names to lowercase.
  3. The plugin will throw an error if you try to embed a non-existent script – similar to: Tag error: -> Textpattern Notice: The requested resource was not found. "script_name".
  4. — In which case check the script exists and your embed tag for typos.

stm_javascript

If stm_javascript is installed and activated you will see two JavaScript tabs in Presentation – one named ‘Javascript’ (stm_javascript – with lowercase ‘s’) and another ‘JavaScript’ (spf_js – uppercase ‘S’). You can copy and paste scripts from stm_javascript to spf_js – and then disable stm_javascript. It’s not advisable to run both plugins simultaneously.

Language support (Textpack)

This plugin uses an English Textpack by default and installs French (fr-fr), German (de-de) and Italian (it-it) Textpacks.

To use your own language see the spf_js_textpack file in this repository.

Version history

0.52 – 21 May 2019

0.51 – November 2012

  • Fixed issue setting prefs in 4.5.×.

0.5 – November 2012

  • Rewritten for Textpattern 4.5.×.

0.41 – June 2012

  • Italian Textpack added (thanks Marco);
  • Last version to support Textpattern 4.4.1 and below.

0.4 – May 2012

0.3 – May 2012

  • Fixed delete issue with script names containing dots (thanks Yiannis).

0.2 – April 2012

  • French & German Textpacks added (thanks Patrick & Uli);
  • added compatibility with the syntax-highlighting spf_codemirror.

0.1 – April 2012

  • first release.
You might also like...
Rah cache minify - HTML compressor module for rah cache Textpattern CMS plugin

Minify module for rah_cache This is a minify module for rah_cache, a full-page caching solution for Textpattern CMS. Rah_cache_minify will minify HTML

Etc cache - Cache plugin for Textpattern CMS

etc_cache Download | Packagist This Textpattern plugin provides an events-driven cache solution for Textpattern CMS. Textpattern is fast, but when you

Asy jpcache - jpcache plugin for Textpattern

asy_jpcache is Full Page Caching for Textpattern1.0 rev.300 and up (including RC5). Install asy_jpcache.txt in the Admin-Panel, and click on _help_ t

Etc pagination - Pagination plugin for Textpattern CMS.

etc_pagination Download | Packagist This Textpattern plugin creates a paginated navigation bar on listings. It has a wide variety of attributes – so y

Smd imagery - A Textpattern CMS plugin for managing images in the Write panel.

smd_imagery Insert images into your Write panel. Very handy for people who run photoblog or image-heavy sites, or those who categorise images for incl

Zem contact reborn - An extensible HTML form mailer plugin for Textpattern CMS.

com_connect Contents Introduction Installing and upgrading Migrating from zem_contact_reborn Usage Tags com_connect tag com_connect_text tag com_conne

Oui instagram - Instagram user infos and recent images embedding plugin for @textpattern

oui_instagram Easily display Instagram recent images galleries. Plugin requirements required: Textpattern CMS 4.6+. recommended: aks_cache or any part

Oui embed - (o)Embed plugin for @Textpattern

oui_embed Embed everything… Get information from any web page (using oembed, opengraph, twitter-cards, scrapping the html, etc). It’s compatible with

Arc youtube - Youtube plugin for Textpattern

arc_youtube A Textpattern plugin for easily embedding Youtube videos in pages using a customisable player. This plugin works well with arc_vimeo and o

Owner
Simon Finch
Simon Finch
Textpattern-installer - Textpattern plugin and theme installer for Composer

Textpattern Installer for Composer Package directory | Issues Install plugins and themes to Textpattern CMS with Composer. $ composer require rah/rah_

Jukka Svahn 7 Apr 14, 2022
Textpattern-for-Panic-Coda - A Textpattern CMS mode for Panic Coda

Textpattern elements for Panic Coda 2 Handy elements for use with Panic Coda 2 on a Mac when authoring files for the Textpattern CMS. This repository

Phil Wareham 8 Jun 26, 2017
Oui cookie - Cookie management plugin for @Textpattern

oui_cookie Introduction Set, check, read, reset or delete cookies manually or through GET/POST parameters. . According to the EU legislation, some coo

Nicolas Morand 3 Mar 19, 2021
Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

Stef Dawson 8 Oct 3, 2020
MassPlugCompiler - Textpattern CMS plugin compiler

mtxpc mtxpc compiles Textpattern CMS plugin sources into installer packages. Supports multi-file structure and a JSON manifest file. Install Using Com

Jukka Svahn 5 Apr 15, 2022
Pat eu cookies law - 🌝 EU Cookie Law Compliance: A Textpattern plugin (or standalone script) for Third-Party Cookies (RGPD compliance)

pat_eu_cookies_law EU Cookie Law Compliance: A Textpattern plugin (or a standalone script) for Third-Party Cookies. A simple solution that respects th

Patrick LEFEVRE 3 Aug 16, 2020
Pat if amp - ⚡ A Textpattern Conditional Plugin for Google's Accelerated Mobile Pages Project (AMP)

pat_if_amp Download | Packagist AMP pages for Textpattern CMS. This conditional tag examines the URL of the current page and determines if the URL end

Patrick LEFEVRE 4 Dec 15, 2019
Arc social share - A Social Bookmarking Plugin for Textpattern

arc_social_share A Social Bookmarking Plugin for Textpattern; easily add links for sharing content with numerous social networks. arc_social_share 1.4

Andy Carter 5 Nov 15, 2022
Unicode-url-for-Textpattern - Plugin for using unicode urls instead of transliterations to ASCII characters

Unicode-url-for-Textpattern Summary textpattern plugin wcz_utf8_url – uses UTF-8 permlinks instead of transliterated ones for SEO Features automatical

Andrij 4 Dec 16, 2017
Arc meta - Textpattern plugin for meta tags to improve site SEO and social marketing.

arc_meta A Textpattern plugin for meta tags to improve site SEO and social marketing. arc_meta adds meta fields to your article, section and category

Andy Carter 3 Jan 20, 2017