Я создаю веб-сайт с помощью phonegap. Я заметил, что bakcbone и jquery -jqm не работают в скомпилированном приложении. Фактически, я получаю затмение следующую ошибку:
Uncaught ReferenceError: Магистраль не определена в файле:///android_asset/www/scripts/JSscript.js: 7
Также я получаю сообщение об ошибке:
Uncaught ReferenceError: requestAnimationFrame не определен в файле:///android_asset/www/scripts/JSscript.js: 4484
И мое событие touch и click не работает в дополнительном приложении. Любая идея, как я могу это исправить??
Порядок JS:
<script type="text/javascript" src="./scripts/jquery.js"></script>
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>
<script src='./scripts/JSscript.js'></script>
И JSscript:
var obj;
var profile;
$(function() {
// Backbone model Creation
var ProfileModel = Backbone.Model.extend({
defaults: {
tstamp: 'adffdsa',
map:"",
tagsCloud:"",
sentiment: "",
usersCloud: "",
timeline: "",
highlights: "",
signals: ""
},
initialize: function() {
}
});
//Backbone model initialization
profile = new ProfileModel({
tstamp: 'adffdsa',
map:"",
tagsCloud:"",
sentiment: "",
usersCloud: "",
timeline: "",
highlights: "",
signals: ""
});
var ProfileList = Backbone.Collection.extend({
model: ProfileModel,
url: 'data.php'
});
var ProfileView = Backbone.View.extend({
el: "#profiles",
template: _.template($('#profileTemplate').html()),
render: function(eventName) {
_.each(this.model.models, function(profile){
var profileTemplate = this.template(profile.toJSON());
//push data to obj for map script
obj = profile.toJSON();
// Add data to DOM element
$(this.el).html(profileTemplate);
}, this);
return this;
}
});
var profiles = new ProfileList([profile]);
var profilesView = new ProfileView({model: profiles});
// Fetching data from server every n seconds
setInterval(function() {
profiles.fetch({reset: true});
}, 4000); // Time in milliseconds
profiles.bind('reset', function () {
profilesView.render();
});
});
EDIT: Я узнал, что внешний url должен быть определен в config.xml с. Таким образом, animation.js работает как шарм. Тем не менее, я не могу найти, почему backbone.je не работает. Кажется, что data.php вызывает проблемы.
var ProfileList = Backbone.Collection.extend({
model: ProfileModel,
url: 'data.php'
});
Я получаю Неизвестную ошибку хрома: 0. Местоположение файла data.php находится на локальном хосте, поэтому я добавляю в адрес config.xml ip. Однако я все еще получаю ошибку хромума. Есть идеи?
JSscript.js
?