Can a javascript area be edited by a client?

Permalink
Can you put javascript nav menu buttons or a slideshow into a concrete5 editable area?

I would like the client to just be able to change the names of the buttons on the Nav dropdown down menu, but it is in Javascript.

I can post code examples.

 
jvansanten replied on at Permalink Reply
Assuming that these are distinct questions, yes. The typical approach is to create a Concrete5 block to integrate the javascript routine into C5.

To make the labels/names of the pages accessible to the user, you'd define individual fields in the db.xml to hold likely the default value. Then, you'd expose those fields to the setup form for the block for the user to modify. The following How-To shows how to create a block with the needed elements as well as an example:http://www.concrete5.org/documentation/how-tos/developers/understan...
mhawke replied on at Permalink Reply
mhawke
If the menu is being generated by the core AutoNav, then it won't be easy because the labels are all generated from the database based on the page titles.

Can you explain again what you want the client to be able to do and why? Perhaps there is an easier way to accomplish what you want.
FalconFlightDesigns replied on at Permalink Reply
This is the pre-built javascript drowp down menu script I am using, here is the script code:
/*
 * Rwyn Menu
 * Author: Brad Touesnard
 *http://brad.touesnard.com/
*/
// Start Configuration
var pixels_per_frame = 4;       // number of pixels to grow every frame
var frame_rate_ms = 50;         // number of millisecondes to pause between frames
var accelerator_on = true;      // toggle acceleration
var single_open_mode = true;    // toggle if only a single blind can be open at a time
var menuid = 'rwynmenu';
// End of Configuration
var height = 0;
var max_height = 0;
var the_node = null;


I need the client to be able to open up the editable area on the webpage, and easily change the name/title of each of the buttons if they want to.

And here is the menu items that appear on the page:
<div class="rwynmenu" id="rwynmenu">
       <li>
            <a href="cd.html" class="group" onclick="act(this);">Construction Debris Recycling</a><div class="items" style="display: none;"></li> 
      <li>
            <a href="javascript: ;" class="group" onclick="act(this);">Recycled Products</a><div class="items" style="display: none;"><a href="asphalt.html" class="item">Recycled Asphalt Shingles</a><a href="gypsumb.html" class="item">Gypsum Bedding</a><a href="woodb.html" class="item">Wood Bedding</a><a href="gypsumf.html" class="item">Gypsum Soil Amendment</a><a href="construction.html" class="item">Construction Materials</a><a href="mulch.html" class="item">Wood Mulch</a></li>    
      <li>   
         <a href="leed.html" class="group" onclick="act(this);">LEED</a><div class="items" style="display: none;"></li> 
      <li>      
            <a href="zero.html" class="group" onclick="act(this);">Zero Landfill Services</a><div class="items" style="display: none;"> </li>  
      <li>
         <a href="construction.html" class="group" onclick="act(this);">Construction Services</a><div class="items" style="display: none;"></li>


For the second part, I would like for the client to be able to add or change a picture in a javascript slideshow in an editable area. Here is the slideshow javascript code:
var fadeShow=(function(){
    var _getCoords = function(el){
       var coords = { x: 0, y: 0, w: el.offsetWidth, h:el.offsetHeight };
       while (el) {
          coords.x += el.offsetLeft;
          coords.y += el.offsetTop;
          el = el.offsetParent;
       }
       return coords;
    }
    var _animOpacity = function(ob){                     //alpha animation
       this.obA=ob;
       this.opacity = 1;
       var me = this;                           //me is a tether reference to the current object
       this.fade=function(){                        //incremental fade


So again, I need the client to be able to add or change the images in the slideshow with the editor.
And here is the slideshow on page code:
<ul class="fadeShow" style="width:600;height:450;">
               <li>images/fade0.jpg</li>
               <li>images/fade1.jpg</li>
               <li>images/fade03.jpg</li>
</ul>


Can I get the concrete5 editor to work with this code?


Thanks for all the help guys.