骨干的问题。我是使用主干编程的新手
我有“this._configure is not a function”的错误,但早期版本的“backbone 0.9.2”和“underscore 1.4.1”运行良好,问题不在ie9上运行,所以我想传递给“backbone 1.0.0“和”undercore 1.4.4“不再适用于任何浏览器。
这是我的代码:
////////////// name of space
var doc;
var PDF = {
Models:{}
,Collections:{}
,Views:{
Items:{}
,Search:{}
,Tags:{}
,View:{}
}
,Variables:{
Array:{}
,Template:{}
}
}
//////////// json
PDF.Variables.Array = [
{'id':0,'name':'Indicadores de Desempeño, Periodo 2004 - 2012','description':'Indicadores de Desempeño, Periodo 2004 - 2012 por SPyDI','url':'../doc/Indicadores-2004-2012.pdf','trumb':'../images/indicadores-2004-2012.png','tags':'Indicadores'}
,{'id':1,'name':'Agenda Estadística 2009','description':'Agenda Estadística 2009 por SPyDI','url':'../doc/AE_2009.pdf','trumb':'../images/agenda_2009.png','tags':'Agenda'}
,{'id':2,'name':'Agenda Estadística 2010','description':'Agenda Estadística 2010 por SPyDI','url':'../doc/AE_2010.pdf','trumb':'../images/agenda_2010.png','tags':'Agenda'}
,{'id':3,'name':'Agenda Estadística 2011','description':'Agenda Estadística 2011 por SPyDI','url':'../doc/AE_2011.pdf','trumb':'../images/agenda_2011.png','tags':'Agenda'}
,{'id':4,'name':'Agenda Estadística 2012','description':'Agenda Estadística 2012 por SPyDI','url':'../doc/AE_2012.pdf','trumb':'../images/agenda_2012.png','tags':'Agenda'}
]
PDF.Variables.Template = "<div id='<%=id%>' class='filaGral' onclick='window.open(\"<%=url%>\")'><div class='filaBoxImage'><img src='<%=trumb%>' width='100' height='125' alt='<%=name%>'/></div><div class='filaBoxText'><div class='filaTitle'><%=name%></div><div class='filaText'><%=description%></div></div></div>"
//////////// obj
PDF.Models = Backbone.Model.extend({
default:{
id: -1
,name: 'unknow'
,description: 'unknow'
,url: '#'
,trumb: '/image/PDF.png'
,tags: 'Backbone, Underscope'
}
});
PDF.Collections = Backbone.Collection.extend({
model: PDF.Models
,initialize:function(){
console.info('Documentos Inicializados');
}
,filtering:function(value){
return _(this.filter(function(data){return data.get('tags') == value}));
}
,searching:function(value){
if(value != "") {
var word = new RegExp(value,'gi');
return _(this.filter(function(data){ if(data.get('name').search(word) != -1) return data }));
}else{
return this;
}
}
});
/////////// view
PDF.Views.Items = Backbone.View.extend({
className:'itemDocument'
,tagName: 'div'
,template:_.template(PDF.Variables.Template)
,initialize:function(){
_.bindAll(this,'render');
}
,render:function(){
this.$el.html(this.template(this.model.toJSON()));
return this;
}
})
PDF.Views.Search = Backbone.View.extend({
events:{
'keyup #searchInput': 'process'
}
,el:$('#questBox')
,initialize:function(){
_.bindAll(this,'process','render');
this.render();
}
,render:function(){
$('#searchInput').val('');
}
,process:function(){
var queryString = this.$el.find('#searchInput').val();
this.trigger('request',{QueryString:queryString});
}
,cleaning: function(){
$('#searchInput').val('');
}
})
PDF.Views.Tags = Backbone.View.extend({
el:$('#BoxUI')
,events:{
'click #bu2': 'process1'
,'click #bu3': 'process2'
,'click #bu4': 'process3'
}
,process1:function(){
this.send('All');
}
,process2:function(){
this.send('Indicadores');
}
,process3:function(){
this.send('Agenda');
}
,send:function(value){
this.trigger('send',{request:value});
}
})
PDF.Views.View = Backbone.View.extend({
el:$('#content')
,initialize:function(){
_.bindAll(this,'render','show','search');
this.searchBox = new PDF.Views.Search();
this.searchBox.on('request',this.search,this);
this.searchBox.on('clean',this.clean,this);
this.collection = new PDF.Collections(PDF.Variables.Array);
this.collection.on('reset',this.show,this);
this.lateralTags = new PDF.Views.Tags();
this.lateralTags.on('send', this.sorf, this);
this.variable = PDF.Variables.Array;
this.render();
}
,render:function(){
this.show();
return this;
}
,show:function(collecion){
if(collecion == undefined) collecion = this.collection,
this.$el.find('#listBox').empty();
collecion.each(function(item){
variable = new PDF.Views.Items({model: item});
$('#listBox').append(variable.render().el);
},this)
}
,search:function(data){
this.show(this.collection.searching(data.QueryString));
}
,sorf:function(value){
if(value.request == '') value = 'All'
if(value.request != 'All'){
this.show(this.collection.filtering(value.request));
this.searchBox.cleaning();
}else{
this.show();
this.searchBox.cleaning();
}
}
})
////// Run
(function($){
doc = new PDF.Views.View();
})(jQuery)
我需要帮助,页面的网址是http://observatorio.uaemex.mx/inicio/documentos.php