2009-02-03 03:44:27

jm
Plugin Author
omega
Real name: Jon-Michael Deldin
From: Missoula, MT
Website

jmd_admin_js: Run page-specific JS in the backend

Download 0.1

This is a little plugin that extends stm_javascript. You can use it to run JS on specific events or on all events in the admin interface (excluding “plugin”).

Offline

 

2009-02-03 08:25:59

jakob
Moderator
omega
From: Germany
Known languages: en, de
Website

Re: jmd_admin_js: Run page-specific JS in the backend

Excellent! Does this mean we could, for instance, add a date-picker to certain custom fields?


TXP Builders – finely-crafted code, design and txp

Offline

 

2009-02-03 08:33:09

jm
Plugin Author
omega
Real name: Jon-Michael Deldin
From: Missoula, MT
Website

Re: jmd_admin_js: Run page-specific JS in the backend

You most certainly can :).

Offline

 

2009-02-03 14:35:34

renobird
Member
xi
Real name: Tom Reno
From: Gainesville, Florida
Website

Re: jmd_admin_js: Run page-specific JS in the backend

Me likey. :)


T

Offline

 

2009-02-03 16:53:05

MattD
Plugin Author
sigma
Real name: Matt Davis
From: Monterey, California
Website

Re: jmd_admin_js: Run page-specific JS in the backend

It’s like a plugin for simpler plugins…


My Plugins

In a way, each of us has an El Guapo to face. -Lucky Day (Three Amigos)

Offline

 

2009-02-11 22:06:21

the_ghost
Plugin Author
pi
Real name: Victor
From: Minsk, The Republic of Belarus
Known languages: Belorussian, English, Russian, German, Italian, France, Turkish
Website

Re: jmd_admin_js: Run page-specific JS in the backend

But how to use it? Where to write js code?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

 

2009-02-11 22:08:33

jm
Plugin Author
omega
Real name: Jon-Michael Deldin
From: Missoula, MT
Website

Re: jmd_admin_js: Run page-specific JS in the backend

Write your JS in Presentation>JS (stm_javascript) and save it as “default” to have it loaded on every admin page or save it as an event name to have it run on certain pages (see help for a list).

Offline

 

2009-02-18 22:29:59

jakob
Moderator
omega
From: Germany
Known languages: en, de
Website

Re: jmd_admin_js: Run page-specific JS in the backend

Jon-Michael, What’s the best way to include javascript libraries such as a jquery add-on (or series thereof)?

For the moment I ‘tricked it’ by closing the open tag, inserting my linked js-file and re-opening the tag:

</script>
<link rel="stylesheet" media="screen" type="text/css" href="/js/theme/ui.all.css" />
<script src='/js/jquery-ui-personalized-1.5.3.js' type='text/javascript'></script>
<script type="text/javascript">

// Adds date-picker to custom-2

$(document).ready(function(){
    $("#custom-2").datepicker({ dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: '/js/theme/calendar.gif', buttonImageOnly: true });
  });

Is there a better way?

Last edited by jakob (2009-02-18 22:53:00)


TXP Builders – finely-crafted code, design and txp

Offline

 

2009-02-19 02:37:10

jm
Plugin Author
omega
Real name: Jon-Michael Deldin
From: Missoula, MT
Website

Re: jmd_admin_js: Run page-specific JS in the backend

If you didn’t want HTML in there, you could paste the contents of the library into default, or use getScript:

$.getScript('/js/jquery-ui-personalized-1.5.3.js');

For the CSS, try:

$('head').append('<link .../>');

Offline

 

2009-02-19 07:16:47

jakob
Moderator
omega
From: Germany
Known languages: en, de
Website

Re: jmd_admin_js: Run page-specific JS in the backend

Thanks. I didn’t know about those two and that looks altogether neater.


TXP Builders – finely-crafted code, design and txp

Offline

 

Powered by FluxBB