Вход Регистрация
Файл: module-assets/admin/jasny-bootstrap/js/jasny-bootstrap.js
Строк: 1111
<?php
/* =============================================================
 * bootstrap-typeahead.js v2.3.1-j6
 * http://twitter.github.com/bootstrap/javascript.html#typeahead
 * =============================================================
 * Copyright 2012 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================ */


!function($){

  
"use strict"// jshint ;_;


 /* TYPEAHEAD PUBLIC CLASS DEFINITION
  * ================================= */

  
var Typeahead = function (elementoptions) {
    
this.$element = $(element)
    
this.options = $.extend({}, $.fn.typeahead.defaultsoptions)
    if (
this.options.targetthis.$target = $(this.options.target)
    
this.matcher this.options.matcher || this.matcher
    this
.sorter this.options.sorter || this.sorter
    this
.highlighter this.options.highlighter || this.highlighter
    this
.updater this.options.updater || this.updater
    this
.source this.options.source
    this
.strict this.options.strict
    this
.$menu = $(this.options.menu)
    
this.shown false

    
if (typeof this.source == 'string') {
        
this.url this.source
        this
.source this.searchAjax
    
}
    
    if (
element.nodeName == 'SELECT'this.replaceSelect()

    
this.text this.$element.val()
    
    
this.$element
      
.attr('data-text'this.value)
      .
attr('autocomplete'"off")
      
    if (
typeof this.$target != 'undefined'this.$element.attr('data-value'this.$target.val())
      else if (
typeof this.$element.attr('data-value') == 'undefined'this.$element.attr('data-value'this.strict '' this.value)
    
    
this.$menu.css('min-width'this.$element.width() + 12)

    
this.listen()
  }

  
Typeahead.prototype = {

    
constructorTypeahead

  
replaceSelect: function () {
      
this.$target this.$element
      this
.$element = $('<input type="text" />')
      
      
this.source = {}
      
this.strict true
      
      
var options this.$target.find('option')
      var 
$option;
      for (var 
i=0i<options.lengthi++) {
        
$option = $(options[i]);
        if (
$option.val() === '') {
          
this.$element.attr('placeholder'$option.html());
          continue;
        }
        
        
this.source[$option.val()] = $option.html()
        if (
this.$target.val() == $option.val()) this.$element.val($option.html())
      }
      
      var 
attr this.$target[0].attributes
      
for (i=0i<attr.lengthi++) {
        if (
attr[i].nodeName != 'type' && attr[i].nodeName != 'name' && attr[i].nodeName != 'id' && attr[i].nodeName != 'data-provide' && !attr[i].nodeName.match(/^on/)) {
          
this.$element.attr(attr[i].nodeNameattr[i].nodeValue)
        }
      }

      
this.$element.insertAfter(this.$target)
      if (
this.$target.attr('autofocus')) this.$element.trigger('focus').select()
      
this.$target.attr('autofocus'false)
      
this.$target.hide()
    }
  
  , 
destroyReplacement: function () {
      
// Detroy replacement element, so it doesn't mess up the browsers autofill on refresh
      
if (typeof this.$target != 'undefined' && this.$target[0].nodeName == 'SELECT') {
        
this.$element.replaceWith('');
      }
    }
  
  , 
select: function () {
      var 
li this.$menu.find('.active')
        , 
val li.attr('data-value')
        , 
text li.find('.item-text').length li.find('.item-text').text() : li.text()

      
val this.updater(val'value')
      
text this.updater(text'text')

      
this.$element
        
.val(text)
        .
attr('data-value'val)
      
      
this.text text
      
      
if (typeof this.$target != 'undefined') {
        
this.$target
          
.val(val)
          .
trigger('change')
      }
      
      
this.$element.trigger('change')
      
      return 
this.hide()
    }

  , 
updater: function (texttype) {
      return 
text
    
}

  , 
show: function () {
      var 
pos = $.extend({}, this.$element.position(), {
        
heightthis.$element[0].offsetHeight
      
})

      
this.$menu
        
.insertAfter(this.$element)
        .
css({
          
toppos.top pos.height
        
leftpos.left
        
})
        .
show()

      
this.shown true
      
return this
    
}

  , 
hide: function () {
      
this.$menu.hide()
      
this.shown false
      
return this
    
}

  , 
lookup: function (event) {
      var 
items

      this
.query this.$element.val()

      if (!
this.query || this.query.length this.options.minLength) {
        return 
this.shown this.hide() : this
      
}

      
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.processthis)) : this.source
      
      
return items this.process(items) : this
    
}

  , 
process: function (items) {
      return $.
isArray(items) ? this.processArray(items) : this.processObject(items)
    }
    
  , 
processArray: function (items) {
      var 
that this

      items 
= $.grep(items, function (item) {
        return 
that.matcher(item)
      })

      
items this.sorter(items)

      if (!
items.length) {
        return 
this.shown this.hide() : this
      
}

      return 
this.render(items.slice(0this.options.items)).show()
    }

  , 
processObject: function (itemsIn) {
      var 
that this
        
items = {}
        , 
0

      
$.each(itemsIn, function (keyitem) {
        if (
that.matcher(item)) items[key] = item
      
})

      
items this.sorter(items)

      if ($.
isEmptyObject(items)) {
        return 
this.shown this.hide() : this
      
}
      
      $.
each(items, function(keyitem) {
        if (
i++ >= that.options.itemsdelete items[key]
      })
      
      return 
this.render(items).show()
    }

  , 
searchAjax: function (queryprocess) {
      var 
that this
      
      
if (this.ajaxTimeoutclearTimeout(this.ajaxTimeout)

      
this.ajaxTimeout setTimeout(function () {
        if (
that.ajaxTimeoutclearTimeout(that.ajaxTimeout)

        if (
query === "") {
          
that.hide()
          return
        }

        $.
get(that.url, {'q'query'limit'that.options.items }, function (items) {
          if (
typeof items == 'string'items JSON.parse(items)
          
process(items)
        })
      }, 
this.options.ajaxdelay)
  }
  
  , 
matcher: function (item) {
      return ~
item.toLowerCase().indexOf(this.query.toLowerCase())
    }

  , 
sorter: function (items) {
      return $.
isArray(items) ? this.sortArray(items) : this.sortObject(items)  
    }

  , 
sortArray: function (items) {
      var 
beginswith = []
        , 
caseSensitive = []
        , 
caseInsensitive = []
        , 
item

      
while (item items.shift()) {
        if (!
item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
        else if (~
item.indexOf(this.query)) caseSensitive.push(item)
        else 
caseInsensitive.push(item)
      }

      return 
beginswith.concat(caseSensitivecaseInsensitive)
    }

  , 
sortObject: function (items) {
      var 
sorted = {}
        , 
key;
        
      for (
key in items) {
        if (!
items[key].toLowerCase().indexOf(this.query.toLowerCase())) {
          
sorted[key] = items[key];
          
delete items[key]
        }
      }
      
      for (
key in items) {
        if (~
items[key].indexOf(this.query)) {
          
sorted[key] = items[key];
          
delete items[key]
        }
      }

      for (
key in items) {
        
sorted[key] = items[key]
      }

      return 
sorted
    
}

  , 
highlighter: function (item) {
      var 
query this.query.replace(/[-[]{}()*+?.,\^$|#s]/g, '\$&')
      
return item.replace(new RegExp('(' query ')''ig'), function ($1match) {
        return 
'<strong>' match '</strong>'
      
})
    }

  , 
render: function (items) {
      var 
that this
        
, list = $([])
      
      $.
map(items, function (itemvalue) {
        if (list.
length >= that.options.items) return
        
        var 
li
          
a
        
        
if ($.isArray(items)) value item
        
        li 
= $(that.options.item)
        
li.find('a').length li.find('a') : li
        a
.html(that.highlighter(item))
        
        
li.attr('data-value'value)
        if (
li.find('a').length === 0li.addClass('dropdown-header')
        
        list.
push(li[0])
      })

      list.
not('.dropdown-header').first().addClass('active')
      
      
this.$menu.html(list)
      
      return 
this
    
}
    
  , 
next: function (event) {
      var 
active this.$menu.find('.active').removeClass('active')
        , 
next active.nextAll('li:not(.dropdown-header)').first()

      if (!
next.length) {
        
next = $(this.$menu.find('li:not(.dropdown-header)')[0])
      }

      
next.addClass('active')
    }

  , 
prev: function (event) {
      var 
active this.$menu.find('.active').removeClass('active')
        , 
prev active.prevAll('li:not(.dropdown-header)').first()

      if (!
prev.length) {
        
prev this.$menu.find('li:not(.dropdown-header)').last()
      }

      
prev.addClass('active')
    }

  , 
listen: function () {
      
this.$element
        
.on('focus',    $.proxy(this.focusthis))
        .
on('blur',     $.proxy(this.blurthis))
        .
on('change',   $.proxy(this.changethis))
        .
on('keypress', $.proxy(this.keypressthis))
        .
on('keyup',    $.proxy(this.keyupthis))

      if (
this.eventSupported('keydown')) {
        
this.$element.on('keydown', $.proxy(this.keydownthis))
      }

      
this.$menu
        
.on('click', $.proxy(this.clickthis))
        .
on('mouseenter''li', $.proxy(this.mouseenterthis))
        .
on('mouseleave''li', $.proxy(this.mouseleavethis))
        
      $(
window).on('unload', $.proxy(this.destroyReplacementthis))
    }

  , 
eventSupported: function(eventName) {
      var 
isSupported eventName in this.$element
      
if (!isSupported) {
        
this.$element.setAttribute(eventName'return;')
        
isSupported typeof this.$element[eventName] === 'function'
      
}
      return 
isSupported
    
}

  , 
move: function (e) {
      if (!
this.shown) return

      switch(
e.keyCode) {
        case 
9// tab
        
case 13// enter
        
case 27// escape
          
e.preventDefault()
          break

        case 
38// up arrow
          
e.preventDefault()
          
this.prev()
          break
          
        case 
40// down arrow
          
e.preventDefault()
          
this.next()
          break
      }

      
e.stopPropagation()
    }

  , 
keydown: function (e) {
      
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
      
this.move(e)
    }

  , 
keypress: function (e) {
      if (
this.suppressKeyPressRepeat) return
      
this.move(e)
    }

  , 
keyup: function (e) {
      switch(
e.keyCode) {
        case 
40// down arrow
        
case 38// up arrow
        
case 16// shift
        
case 17// ctrl
        
case 18// alt
          
break

        case 
9// tab
        
case 13// enter
          
if (!this.shown) return
          
this.select()
          break

        case 
27// escape
          
if (!this.shown) return
          
this.hide()
          break

        default:
          
this.lookup()
      }

      
e.stopPropagation()
      
e.preventDefault()
  }

  , 
change: function (e) {
      var 
value
      
      
if (this.$element.val() != this.text) {
        
value this.$element.val() === '' || this.strict '' this.$element.val()
            
        
this.$element.val(value)
        
this.$element.attr('data-value'value)
        
this.text value
        
if (typeof this.$target != 'undefined'this.$target.val(value)
      }
    }

  , 
focus: function (e) {
      
this.focused true
    
}
    
  , 
blur: function (e) {
      
this.focused false
      
if (!this.mousedover && this.shownthis.hide()
    }

  , 
click: function (e) {
      
e.stopPropagation()
      
e.preventDefault()
      
this.select()
      
this.$element.focus()
    }

  , 
mouseenter: function (e) {
      
this.mousedover true
      this
.$menu.find('.active').removeClass('active')
      $(
e.currentTarget).addClass('active')
    }

  , 
mouseleave: function (e) {
      
this.mousedover false
      
if (!this.focused && this.shownthis.hide()
    }

  }


  
/* TYPEAHEAD PLUGIN DEFINITION
   * =========================== */

  
var old = $.fn.typeahead

  
$.fn.typeahead = function (option) {
    return 
this.each(function () {
      var 
$this = $(this)
        , 
data $this.data('typeahead')
        , 
options typeof option == 'object' && option
      
if (!data$this.data('typeahead', (data = new Typeahead(thisoptions)))
      if (
typeof option == 'string'data[option]()
    })
  }

  $.
fn.typeahead.defaults = {
    
source: []
  , 
items8
  
menu'<ul class="typeahead dropdown-menu"></ul>'
  
item'<li><a href="#"></a></li>'
  
ajaxdelay400
  
minLength1
  
}

  $.
fn.typeahead.Constructor Typeahead


 
/* TYPEAHEAD NO CONFLICT
  * =================== */

  
$.fn.typeahead.noConflict = function () {
    $.
fn.typeahead old
    
return this
  
}


 
/* TYPEAHEAD DATA-API
  * ================== */

  
$(document)
    .
off('focus.typeahead.data-api')  // overwriting Twitter's typeahead 
    
.on('focus.typeahead.data-api''[data-provide="typeahead"]', function (e) {
      var 
$this = $(this)
      if (
$this.data('typeahead')) return
      if (
$this.is('select')) $this.attr('autofocus'true)
      
e.preventDefault()
      
$this.typeahead($this.data())
  })

}(
window.jQuery);
/* ===========================================================
 * bootstrap-inputmask.js j2
 * http://twitter.github.com/bootstrap/javascript.html#tooltips
 * Based on Masked Input plugin by Josh Bush (digitalbush.com)
 * ===========================================================
 * Copyright 2012 Jasny BV, Netherlands.
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================== */

!function ($) {

  
"use strict"// jshint ;_;

  
var isIphone = (window.orientation !== undefined),
      
isAndroid navigator.userAgent.toLowerCase().indexOf("android") > -1


 
/* INPUTMASK PUBLIC CLASS DEFINITION
  * ================================= */

  
var Inputmask = function (elementoptions) {
    if (
isAndroid) return // No support because caret positioning doesn't work on Android
    
    
this.$element = $(element)
    
this.options = $.extend({}, $.fn.inputmask.defaultsoptions)
    
this.mask String(options.mask)
    
    
this.init()
    
this.listen()
        
    
this.checkVal() //Perform initial check for existing values
  
}

  
Inputmask.prototype = {
    
    
init: function() {
      var 
defs this.options.definitions
      
var len this.mask.length

      this
.tests = [] 
      
this.partialPosition this.mask.length
      this
.firstNonMaskPos null

      
$.each(this.mask.split(""), $.proxy(function(ic) {
        if (
== '?') {
          
len--
          
this.partialPosition i
        
} else if (defs[c]) {
          
this.tests.push(new RegExp(defs[c]))
          if(
this.firstNonMaskPos === null)
            
this.firstNonMaskPos =  this.tests.length 1
        
} else {
          
this.tests.push(null)
        }
      }, 
this))

      
this.buffer = $.map(this.mask.split(""), $.proxy(function(ci) {
        if (
!= '?') return defs[c] ? this.options.placeholder c
      
}, this))
      
      
this.focusText this.$element.val()

      
this.$element.data("rawMaskFn", $.proxy(function() {
        return $.
map(this.buffer, function(ci) {
          return 
this.tests[i] && != this.options.placeholder null
        
}).join('')
      }, 
this))
    },
    
    
listen: function() {
      if (
this.$element.attr("readonly")) return

      var 
pasteEventName = (navigator.userAgent.match(/msie/i) ? 'paste' 'input') + ".mask"

      
this.$element
        
.on("unmask", $.proxy(this.unmaskthis))
        
        .
on("focus.mask", $.proxy(this.focusEventthis))
        .
on("blur.mask", $.proxy(this.blurEventthis))
        
        .
on("keydown.mask", $.proxy(this.keydownEventthis))
        .
on("keypress.mask", $.proxy(this.keypressEventthis))

        .
on(pasteEventName, $.proxy(this.pasteEventthis))
    },

    
//Helper Function for Caret positioning
    
caret: function(beginend) {
      if (
this.$element.length === 0) return
      if (
typeof begin == 'number') {
        
end = (typeof end == 'number') ? end begin
        
return this.$element.each(function() {
          if (
this.setSelectionRange) {
            
this.setSelectionRange(beginend)
          } else if (
this.createTextRange) {
            var 
range this.createTextRange()
            
range.collapse(true)
            
range.moveEnd('character'end)
            
range.moveStart('character'begin)
            
range.select()
          }
        })
      } else {
        if (
this.$element[0].setSelectionRange) {
          
begin this.$element[0].selectionStart
          end 
this.$element[0].selectionEnd
        
} else if (document.selection && document.selection.createRange) {
          var 
range document.selection.createRange()
          
begin range.duplicate().moveStart('character', -100000)
          
end begin range.text.length
        
}
        return {
          
beginbegin
          
endend
        
}
      }
    },
    
    
seekNext: function(pos) {
      var 
len this.mask.length
      
while (++pos <= len && !this.tests[pos]);
      
      return 
pos
    
},
    
    
seekPrev: function(pos) {
      while (--
pos >= && !this.tests[pos]);
      
      return 
pos
    
},

    
shiftL: function(begin,end) {
      var 
len this.mask.length
      
      
if(begin<0) return
      
      for (var 
begin,this.seekNext(end); leni++) {
        if (
this.tests[i]) {
          if (
len && this.tests[i].test(this.buffer[j])) {
            
this.buffer[i] = this.buffer[j]
            
this.buffer[j] = this.options.placeholder
          
} else
            break
          
this.seekNext(j)
        }
      }
      
this.writeBuffer()
      
this.caret(Math.max(this.firstNonMaskPosbegin))
    },

    
shiftR: function(pos) {
      var 
len this.mask.length
      
      
for (var posthis.options.placeholderleni++) {
        if (
this.tests[i]) {
          var 
this.seekNext(i)
          var 
this.buffer[i]
          
this.buffer[i] = c
          
if (len && this.tests[j].test(t))
            
t
          
else
            break
        }
      }
    },

    
unmask: function() {
      
this.$element
        
.unbind(".mask")
        .
removeData("inputmask")
    },
    
    
focusEvent: function() {
      
this.focusText this.$element.val()
      var 
len this.mask.length 
      
var pos this.checkVal()
      
this.writeBuffer()

      var 
that this
      
var moveCaret = function() {
        if (
pos == len)
          
that.caret(0pos)
        else
          
that.caret(pos)
      }

      if ($.
browser.msie)
        
moveCaret()
      else
        
setTimeout(moveCaret0)
    },
    
    
blurEvent: function() {
      
this.checkVal()
      if (
this.$element.val() != this.focusText)
        
this.$element.trigger('change')
    },
        
    
keydownEvent: function(e) {
      var 
k=e.which

      
//backspace, delete, and escape get special treatment
      
if (== || == 46 || (isIphone && == 127)) {
        var 
pos this.caret(),
        
begin pos.begin,
        
end pos.end
                        
        
if (end-begin === 0) {
          
begin k!=46 this.seekPrev(begin) : (end=this.seekNext(begin-1))
          
end k==46 this.seekNext(end) : end
        
}
        
this.clearBuffer(beginend)
        
this.shiftL(begin,end-1)

        return 
false
      
} else if (== 27) {//escape
        
this.$element.val(this.focusText)
        
this.caret(0this.checkVal())
        return 
false
      
}
    },

    
keypressEvent: function(e) {
      var 
len this.mask.length
      
      
var e.which,
      
pos this.caret()

      if (
e.ctrlKey || e.altKey || e.metaKey || k<32)  {//Ignore
        
return true
      
} else if (k) {
        if (
pos.end pos.begin !== 0) {
          
this.clearBuffer(pos.beginpos.end)
          
this.shiftL(pos.beginpos.end-1)
        }

        var 
this.seekNext(pos.begin 1)
        if (
len) {
          var 
String.fromCharCode(k)
          if (
this.tests[p].test(c)) {
            
this.shiftR(p)
            
this.buffer[p] = c
            this
.writeBuffer()
            var 
next this.seekNext(p)
            
this.caret(next)
          }
        }
        return 
false
      
}
    },

    
pasteEvent: function() {
      var 
that this
      
      setTimeout
(function() {
        
that.caret(that.checkVal(true))
      }, 
0)
    },
    
    
clearBuffer: function(startend) {
      var 
len this.mask.length
      
      
for (var startend && leni++) {
        if (
this.tests[i])
          
this.buffer[i] = this.options.placeholder
      
}
    },

    
writeBuffer: function() {
      return 
this.$element.val(this.buffer.join('')).val()
    },

    
checkVal: function(allow) {
      var 
len this.mask.length
      
//try to place characters where they belong
      
var test this.$element.val()
      var 
lastMatch = -1
      
      
for (var 0pos 0leni++) {
        if (
this.tests[i]) {
          
this.buffer[i] = this.options.placeholder
          
while (pos++ < test.length) {
            var 
test.charAt(pos 1)
            if (
this.tests[i].test(c)) {
              
this.buffer[i] = c
              lastMatch 
i
              
break
            }
          }
          if (
pos test.length)
            break
        } else if (
this.buffer[i] == test.charAt(pos) && != this.partialPosition) {
          
pos++
          
lastMatch i
        
}
      }
      if (!
allow && lastMatch this.partialPosition) {
        
this.$element.val("")
        
this.clearBuffer(0len)
      } else if (
allow || lastMatch >= this.partialPosition) {
        
this.writeBuffer()
        if (!
allowthis.$element.val(this.$element.val().substring(0lastMatch 1))
      }
      return (
this.partialPosition this.firstNonMaskPos)
    }
  }

  
 
/* INPUTMASK PLUGIN DEFINITION
  * =========================== */

  
$.fn.inputmask = function (options) {
    return 
this.each(function () {
      var 
$this = $(this)
      , 
data $this.data('inputmask')
      if (!
data$this.data('inputmask', (data = new Inputmask(thisoptions)))
    })
  }

  $.
fn.inputmask.defaults = {
    
mask"",
    
placeholder"_",
    
definitions: {
      
'9'"[0-9]",
      
'a'"[A-Za-z]",
      
'?'"[A-Za-z0-9]",
      
'*'"."
    
}
  }

  $.
fn.inputmask.Constructor Inputmask


 
/* INPUTMASK DATA-API
  * ================== */

  
$(document).on('focus.inputmask.data-api''[data-mask]', function (e) {
    var 
$this = $(this)
    if (
$this.data('inputmask')) return
    
e.preventDefault()
    
$this.inputmask($this.data())
  })

}(
window.jQuery);
/* ============================================================
 * bootstrap-rowlink.js j1
 * http://jasny.github.com/bootstrap/javascript.html#rowlink
 * ============================================================
 * Copyright 2012 Jasny BV, Netherlands.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================ */

!function ($) {
  
  
"use strict"// jshint ;_;

  
var Rowlink = function (elementoptions) {
    
options = $.extend({}, $.fn.rowlink.defaultsoptions)
    var 
tr element.nodeName.toLowerCase() == 'tr' ? $(element) : $(element).find('tr:has(td)')
    
    
tr.each(function() {
      var 
link = $(this).find(options.target).first()
      if (!
link.length) return
      
      var 
href link.attr('href')

      $(
this).find('td').not('.nolink').click(function() {
        
window.location href;
      })

      $(
this).addClass('rowlink')
      
link.replaceWith(link.html())
    })
  }

  
 
/* ROWLINK PLUGIN DEFINITION
  * =========================== */

  
$.fn.rowlink = function (options) {
    return 
this.each(function () {
      var 
$this = $(this)
      , 
data $this.data('rowlink')
      if (!
data$this.data('rowlink', (data = new Rowlink(thisoptions)))
    })
  }

  $.
fn.rowlink.defaults = {
    
target"a"
  
}

  $.
fn.rowlink.Constructor Rowlink


 
/* ROWLINK DATA-API
  * ================== */

  
$(function () {
    $(
'[data-provide="rowlink"],[data-provides="rowlink"]').each(function () {
      $(
this).rowlink($(this).data())
    })
  })
  
}(
window.jQuery);
/* ===========================================================
 * bootstrap-fileupload.js j2
 * http://jasny.github.com/bootstrap/javascript.html#fileupload
 * ===========================================================
 * Copyright 2012 Jasny BV, Netherlands.
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================== */

!function ($) {

  
"use strict"// jshint ;_

 /* FILEUPLOAD PUBLIC CLASS DEFINITION
  * ================================= */

  
var Fileupload = function (elementoptions) {
    
this.$element = $(element)
    
this.type this.$element.data('uploadtype') || (this.$element.find('.thumbnail').length "image" "file")
      
    
this.$input this.$element.find(':file')
    if (
this.$input.length === 0) return

    
this.name this.$input.attr('name') || options.name

    this
.$hidden this.$element.find('input[type=hidden][name="'+this.name+'"]')
    if (
this.$hidden.length === 0) {
      
this.$hidden = $('<input type="hidden" />')
      
this.$element.prepend(this.$hidden)
    }

    
this.$preview this.$element.find('.fileupload-preview')
    var 
height this.$preview.css('height')
    if (
this.$preview.css('display') != 'inline' && height != '0px' && height != 'none'this.$preview.css('line-height'height)

    
this.original = {
      
'exists'this.$element.hasClass('fileupload-exists'),
      
'preview'this.$preview.html(),
      
'hiddenVal'this.$hidden.val()
    }
    
    
this.$remove this.$element.find('[data-dismiss="fileupload"]')

    
this.$element.find('[data-trigger="fileupload"]').on('click.fileupload', $.proxy(this.triggerthis))

    
this.listen()
  }
  
  
Fileupload.prototype = {
    
    
listen: function() {
      
this.$input.on('change.fileupload', $.proxy(this.changethis))
      $(
this.$input[0].form).on('reset.fileupload', $.proxy(this.resetthis))
      if (
this.$removethis.$remove.on('click.fileupload', $.proxy(this.clearthis))
    },
    
    
change: function(einvoked) {
      if (
invoked === 'clear') return
      
      var 
file e.target.files !== undefined e.target.files[0] : (e.target.value ? { namee.target.value.replace(/^.+\/, '') } : null)
      
      if (!
file) {
        
this.clear()
        return
      }
      
      
this.$hidden.val('')
      
this.$hidden.attr('name''')
      
this.$input.attr('name'this.name)

      if (
this.type === "image" && this.$preview.length && (typeof file.type !== "undefined" file.type.match('image.*') : file.name.match(/.(gif|png|jpe?g)$/i)) && typeof FileReader !== "undefined") {
        var 
reader = new FileReader()
        var 
preview this.$preview
        
var element this.$element

        reader
.onload = function(e) {
          
preview.html('<img src="' e.target.result '" ' + (preview.css('max-height') != 'none' 'style="max-height: ' preview.css('max-height') + ';"' '') + ' />')
          
element.addClass('fileupload-exists').removeClass('fileupload-new')
        }

        
reader.readAsDataURL(file)
      } else {
        
this.$preview.text(file.name)
        
this.$element.addClass('fileupload-exists').removeClass('fileupload-new')
      }
    },

    
clear: function(e) {
      
this.$hidden.val('')
      
this.$hidden.attr('name'this.name)
      
this.$input.attr('name''')

      
//ie8+ doesn't support changing the value of input with type=file so clone instead
      
if (navigator.userAgent.match(/msie/i)){ 
          var 
inputClone this.$input.clone(true);
          
this.$input.after(inputClone);
          
this.$input.remove();
          
this.$input inputClone;
      }else{
          
this.$input.val('')
      }

      
this.$preview.html('')
      
this.$element.addClass('fileupload-new').removeClass('fileupload-exists')

      if (
e) {
        
this.$input.trigger('change', [ 'clear' ])
        
e.preventDefault()
      }
    },
    
    
reset: function(e) {
      
this.clear()
      
      
this.$hidden.val(this.original.hiddenVal)
      
this.$preview.html(this.original.preview)
      
      if (
this.original.existsthis.$element.addClass('fileupload-exists').removeClass('fileupload-new')
       else 
this.$element.addClass('fileupload-new').removeClass('fileupload-exists')
    },
    
    
trigger: function(e) {
      
this.$input.trigger('click')
      
e.preventDefault()
    }
  }

  
 
/* FILEUPLOAD PLUGIN DEFINITION
  * =========================== */

  
$.fn.fileupload = function (options) {
    return 
this.each(function () {
      var 
$this = $(this)
      , 
data $this.data('fileupload')
      if (!
data$this.data('fileupload', (data = new Fileupload(thisoptions)))
      if (
typeof options == 'string'data[options]()
    })
  }

  $.
fn.fileupload.Constructor Fileupload


 
/* FILEUPLOAD DATA-API
  * ================== */

  
$(document).on('click.fileupload.data-api''[data-provides="fileupload"]', function (e) {
    var 
$this = $(this)
    if (
$this.data('fileupload')) return
    
$this.fileupload($this.data())
      
    var 
$target = $(e.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');
    if (
$target.length 0) {
      
$target.trigger('click.fileupload')
      
e.preventDefault()
    }
  })

}(
window.jQuery);
?>
Онлайн: 1
Реклама