/usr/share/javascript/backbone/backbone.stickit.min.js is in libjs-backbone.stickit 0.7.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 | (function(a){if(typeof define==="function"&&define.amd){define(["underscore","backbone"],a)}else{if(typeof exports==="object"){a(require("underscore"),require("backbone"))}else{a(_,Backbone)}}}(function(i,h){h.Stickit={_handlers:[],addHandler:function(n){n=i.map(i.flatten([n]),function(o){return i.extend({updateModel:true,updateView:true,updateMethod:"text"},o)});this._handlers=this._handlers.concat(n)}};i.extend(h.View.prototype,{_modelBindings:null,unstickit:function(n){var o=[];i.each(this._modelBindings,function(q,p){if(n&&q.model!==n){return false}q.model.off(q.event,q.fn);o.push(q.model);delete this._modelBindings[p]},this);i.invoke(i.uniq(o),"trigger","stickit:unstuck",this.cid);this._modelBindings=i.compact(this._modelBindings);this.$el.off(".stickit"+(n?"."+n.cid:""))},stickit:function(o,q){var p=o||this.model,r=".stickit."+p.cid,s=q||i.result(this,"bindings")||{};this._modelBindings||(this._modelBindings=[]);this.unstickit(p);i.each(s,function(u,t){var z,y,B,x,A=s[t]||{},w=i.uniqueId();z=t===":el"?this.$el:this.$(t);if(!z.length){return}if(i.isString(A)){A={observe:A}}if(i.isFunction(A.observe)){A.observe=A.observe.call(this)}x=k(z,A);B=x.observe;x.bindId=w;x.view=this;y=i.extend({stickitChange:x},x.setOptions);f(this,z,x,p,B);c(this,z,x,p,B);if(B){i.each(x.events,function(v){var C=v+r;var D=function(E){var F=x.getVal.call(this,z,E,x,i.rest(arguments));if(e(this,x.updateModel,F,E,x)){d(p,B,F,y,this,x)}};D=i.bind(D,this);if(t===":el"){this.$el.on(C,D)}else{this.$el.on(C,t,D)}},this);i.each(i.flatten([B]),function(v){m(p,this,"change:"+v,function(D,E,C){var F=C&&C.stickitChange&&C.stickitChange.bindId||null;if(F!==w){j(this,z,x,g(D,B,x,this),D)}})},this);j(this,z,x,g(p,B,x,this),p,true)}p.once("stickit:unstuck",function(v){if(v===this.cid){a(this,x.destroy,z,p,x)}},this);a(this,x.initialize,z,p,x)},this);var n=this.remove;this.remove=function(){var t=this;this.unstickit();if(n){t=n.apply(this,i.rest(arguments))}return t}}});var l=function(q,p){var o=(p||"").split(".");var n=i.reduce(o,function(r,s){return r[s]},q);return n==null?q:n};var a=function(n,o){if(o){return(i.isString(o)?l(n,o):o).apply(n,i.rest(arguments,2))}};var b=function(n){return n.find("option").not(function(){return !this.selected})};var e=function(o,n){if(i.isBoolean(n)){return n}else{if(i.isFunction(n)||i.isString(n)){return a.apply(this,arguments)}}return false};var m=function(o,n,q,p){o.on(q,p,n);n._modelBindings.push({model:o,event:q,fn:p})};var d=function(q,n,t,p,r,o){var s={};if(o.onSet){t=a(r,o.onSet,t,o)}if(o.set){a(r,o.set,n,t,p,o)}else{s[n]=t;if(i.isArray(n)&&i.isArray(t)){s=i.reduce(n,function(u,w,v){u[w]=i.has(t,v)?t[v]:null;return u},{})}q.set(s,p)}};var g=function(q,n,p,s){var t,o=function(u){return q[p.escape?"escape":"get"](u)},r=function(u){return u==null?"":u};t=i.isArray(n)?i.map(n,o):o(n);if(p.onGet){t=a(s,p.onGet,t,p)}return i.isArray(t)?i.map(t,r):r(t)};var k=h.Stickit.getConfiguration=function(p,q){var n=[{updateModel:false,updateMethod:"text",update:function(s,u,r,t){if(s[t.updateMethod]){s[t.updateMethod](u)}},getVal:function(r,t,s){return r[s.updateMethod]()}}];n=n.concat(i.filter(h.Stickit._handlers,function(r){return p.is(r.selector)}));n.push(q);var o=i.extend.apply(i,n);if(o.visible&&!i.has(o,"updateView")){o.updateView=false}else{if(!i.has(o,"updateView")){o.updateView=true}}delete o.selector;return o};var f=function(n,q,p,o,s){var r=["autofocus","autoplay","async","checked","controls","defer","disabled","hidden","indeterminate","loop","multiple","open","readonly","required","scoped","selected"];i.each(p.attributes||[],function(u){var t="",v,w;u=i.clone(u);v=u.observe||(u.observe=s),w=function(){var x=i.indexOf(r,u.name,true)>-1?"prop":"attr",y=g(o,v,u,n);if(u.name==="class"){q.removeClass(t).addClass(y);t=y}else{q[x](u.name,y)}};i.each(i.flatten([v]),function(x){m(o,n,"change:"+x,w)});w()})};var c=function(n,q,p,o,s){if(p.visible==null){return}var r=function(){var w=p.visible,u=p.visibleFn,v=g(o,s,p,n),t=!!v;if(i.isFunction(w)||i.isString(w)){t=!!a(n,w,v,p)}if(u){a(n,u,q,t,p)}else{q.toggle(t)}};i.each(i.flatten([s]),function(t){m(o,n,"change:"+t,r)});r()};var j=function(o,r,q,s,p,n){if(!e(o,q.updateView,s,q)){return}a(o,q.update,r,s,p,q);if(!n){a(o,q.afterUpdate,r,s,q)}};h.Stickit.addHandler([{selector:'[contenteditable="true"]',updateMethod:"html",events:["input","change"]},{selector:"input",events:["propertychange","input","change"],update:function(n,o){n.val(o)},getVal:function(n){return n.val()}},{selector:"textarea",events:["propertychange","input","change"],update:function(n,o){n.val(o)},getVal:function(n){return n.val()}},{selector:'input[type="radio"]',events:["change"],update:function(n,o){n.filter('[value="'+o+'"]').prop("checked",true)},getVal:function(n){return n.filter(":checked").val()}},{selector:'input[type="checkbox"]',events:["change"],update:function(p,r,o,n){if(p.length>1){r||(r=[]);p.each(function(s,t){var v=h.$(t);var u=i.indexOf(r,v.val())>-1;v.prop("checked",u)})}else{var q=i.isBoolean(r)?r:r===p.val();p.prop("checked",q)}},getVal:function(n){var o;if(n.length>1){o=i.reduce(n,function(q,r){var s=h.$(r);if(s.prop("checked")){q.push(s.val())}return q},[])}else{o=n.prop("checked");var p=n.val();if(p!=="on"&&p!=null){o=o?n.val():null}}return o}},{selector:"select",events:["change"],update:function(z,q,u,A){var v,y=A.selectOptions,x=y&&y.collection||undefined,t=z.prop("multiple");if(!y){y={};var w=function(B){return B.map(function(){return{value:this.value,label:this.text}}).get()};if(z.find("optgroup").length){x={opt_labels:[]};if(z.find("> option").length){x.opt_labels.push(undefined);i.each(z.find("> option"),function(B){x[undefined]=w(h.$(B))})}i.each(z.find("optgroup"),function(C){var B=h.$(C).attr("label");x.opt_labels.push(B);x[B]=w(h.$(C).find("option"))})}else{x=w(z.find("option"))}}y.valuePath=y.valuePath||"value";y.labelPath=y.labelPath||"label";var r=function(B,C,D){i.each(B,function(H){var F=h.$("<option/>"),G=H;var E=function(J,I){F.text(J);G=I;F.data("stickit_bind_val",G);if(!i.isArray(G)&&!i.isObject(G)){F.val(G)}};if(H==="__default__"){E(y.defaultOption.label,y.defaultOption.value)}else{E(l(H,y.labelPath),l(H,y.valuePath))}if(!t&&G!=null&&D!=null&&G===D||(i.isObject(D)&&i.isEqual(G,D))){F.prop("selected",true)}else{if(t&&i.isArray(D)){i.each(D,function(I){if(i.isObject(I)){I=l(I,y.valuePath)}if(I===G||(i.isObject(I)&&i.isEqual(G,I))){F.prop("selected",true)}})}}C.append(F)})};z.html("");var p=function(B,D){var C=window;if(D.indexOf("this.")===0){C=B}D=D.replace(/^[a-z]*\.(.+)$/,"$1");return l(C,D)};if(i.isString(x)){v=p(this,x)}else{if(i.isFunction(x)){v=a(this,x,z,A)}else{v=x}}if(v instanceof h.Collection){v=v.toJSON()}if(y.defaultOption){r(["__default__"],z)}if(i.isArray(v)){r(v,z,q)}else{if(v.opt_labels){i.each(v.opt_labels,function(B){var C=h.$("<optgroup/>").attr("label",B);r(v[B],C,q);z.append(C)})}else{var n=[],o;for(var s in v){o={};o[y.valuePath]=s;o[y.labelPath]=v[s];n.push(o)}r(i.sortBy(n,y.comparator||y.labelPath),z,q)}}},getVal:function(n){var o;if(n.prop("multiple")){o=h.$(b(n).map(function(){return h.$(this).data("stickit_bind_val")})).get()}else{o=b(n).data("stickit_bind_val")}return o}}])}));
|