Import the Javascript library as a static file not work but working from URL

Hi, I need to use the oCanvas library: download - oCanvas - oriented drawing canvas object in a page.

I followed this guide: filing of APEX JavaScript static file

I've downloaded the library and the updloaded in sharing of components/static files and referenced in the page header:

< script src = "" #APP_IMAGES #ocanvas.js "type =" text/JavaScript"> < / script >"

On the page, I created a html subregion and in the body, used the following test code:

< canvas id = "canvas" width = "200" height = "100" > < / canvas >

< script >

output function (label, entry) {}

var out = document.getElementById ("output"),

input_string = ' ", i, number;

If (typeof input = 'object') {}

input_string += "{\n";

for {(i input)

number =! isNaN (parseFloat (input [i]))? true: false;

input_string += ' < span class =------"tab\" > \t </span > ' + i + ":" + (number? ' ")". " "': ' \ '") + input [i] + (number? "": "\" "") + "\n";

}

input_string += '} \n ";

}

out.innerHTML += (out.innerHTML = ""?) ("": "\n") + label + input_string;

}

var c = document.querySelector ("#canvas"),

CTX = c.getContext ("2d");

c.Width = window.innerWidth;

c.Height = window.innerHeight;

c.addEventListener ("touchmove", function (e) {e.preventDefault ()}; false);

var canvas = oCanvas.create ({canvas: "#canvas", the decoration: "#222" "});

Planet Center

Var Center = canvas.display.ellipse({)

x: canvas.width / 2, y: canvas.height / 2,.

RADIUS: canvas.width / 20,.

fill: "#fff."

({. add()});

Prototype that will be used to instantiate other objects

var satelliteProto = canvas.display.ellipse ({fill: "#eee"});

var pathProto = canvas.display.ellipse ({stroke: "1px #999"});

Implement data

satellites of var = [], depth = 3;

var satelliteColors = ["#107B 99", "#5F92C0", "#c7509f"];

var pathColors = ["#666", "#107B 99", "#5F92C0"];

Create seven satellites and access roads. Definition is longer down.

for (var i = 0, l = 7; i < l; i ++) {}

createSatellite({)

parent: focus, depth: 1,.

distance: (i + 1) * canvas.width / 6,.

RADIUS: canvas.width / 100,.

Speed: 1

});

}

Set up a tick function that moves all satellites each image

canvas.setLoop (function () {}

for (var i = 0, l = satellites.length; i < l; i ++) {}

satellites [i] .rotation += satellites [i] .speed;

}

});

Definition of a satellite and its corresponding path

function createSatellite (options) {}

Create the path which will follow the satellite

var path = pathProto.clone({)

Ray: options.distance,.

x: options.x | 0, y: options.y | 0,

strokeColor: pathColors [options.depth - 1]

});

options.parent.addChild (path);

Create a new satellite

satellite var = satelliteProto.clone({)

origin: {}

x: 0,.

y: options.distance * (Math.round (Math.random ())?-1: 1)

},

Speed: Math.Random () * (2 * Math.Random () - 0.5) + 0.5,.

Ray: options.radius,.

x: options.x | 0, y: options.y | 0,

filling: satelliteColors [options.depth - 1].

rotation: Math.Random () * 360

});

options.parent.addChild (satellite);

satellites.push (satellite);

Create another satellite which will tour around the hub

If (options.depth < depth) {}

createSatellite({)

parent: satellite, depth: + 1 options.depth,

distance: options.radius * 7.

RADIUS: options.radius / 1.5,.

x: satellite.origin.x *-1, y: satellite.origin.y *-1;

Speed: 10

});

}

}

Implement control of play/pause for the demo

var text = canvas.display.text({)

x: canvas.width / 2, y: 220,.

origin: {x: 'Centre', y: 'Center'},

filling: '#fff', size: 25, weight: 'bold', text: 'Play '.

({. add()});

Canvas.bind ("click tap", function () {})

Text.Text = canvas.timeline.running? 'Play': 'Pause '; Canvas.Redraw ();

Canvas.Timeline [Canvas.Timeline.Running? "stop": "start"] ();

});

< /script >

That does not work, but if I change reference from the page to the next header it works:

<script src="http://cdnjs.cloudflare.com/ajax/libs/ocanvas/2.7.2/ocanvas.min.js"></script>

What can I do to use the static reference correctly?

It's a library problem?

I created a test workspace, there are two pages with the static reference and the other with the URL reference, here's the connection info, if you want to try it:

https://Apex.Oracle.com/pls/Apex/f?p=4550:1:0:

workspace: ocanvas

user: user

Pass: ocanvas

Thank you for your time.

The file you have downloaded seems to have some formatting problems (missing CR/LF?).   I downloaded the same file from the remote site and referenced and it works.  Also, you can simply reference the file in the page URL of file header instead of add field tags in the html header scripts.

-Jeff

Tags: Database

Similar Questions

Maybe you are looking for

  • can't play videos of espn/fox

    I use to watch videos ESPN streamed in FF.I have the latest version of FF (41.0.2) and the inactive sites are espnplay.com and foxplay.com.It is not a problem with my cable provider because I am able to videos in Chrome.In fact, this problem started

  • Weird random stop code - 128

    Recently I started having some problems with my Macbook Pro 15 mid-2014 retina. While the work screen goes black and the computer shuts down. When booting all previously open windows reopen without showing unexpected shutdown > send the error to Appl

  • Reduction in file size of scanned documents

    ISSA. I analyze the statements of income, statements etc. with several banking pages in pdf format, then want to send them an email with several pdf files attached to a single email. My file sizes are 3 MB, 8 MB, 12MB, etc. even if I scan only about

  • Reset button control

    Can I reset a button control programmatically?  Specifically, I'm eager to pass a Boolean button to a false state in response to certain events or conditions. For example, consider the attached VI.  (It's not over, because I don't know how to finish.

  • If Windows will send a message when she install the driver for a USB device successfully or unsuccessfully?

    As you know, the window search and install the driver for a new device (USB) coming. We can get the status of the device through Device Manager manually. but I was blocked by the following questions when trying to obtain programmatically. Is it possi