angular-cookies.min.js 2.31 KB
Newer Older
1 2 3 4
/*
 AngularJS v1.4.3
 (c) 2010-2015 Google, Inc. http://angularjs.org
 License: MIT
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
 */
(function (p, g, l) {
    'use strict';
    function m(b, a, f) {
        var c = f.baseHref(), k = b[0];
        return function (b, d, e) {
            var f, h;
            e = e || {};
            h = e.expires;
            f = g.isDefined(e.path) ? e.path : c;
            d === l && (h = "Thu, 01 Jan 1970 00:00:00 GMT", d = "");
            g.isString(h) && (h = new Date(h));
            d = encodeURIComponent(b) + "=" + encodeURIComponent(d);
            d = d + (f ? ";path=" + f : "") + (e.domain ? ";domain=" + e.domain : "");
            d += h ? ";expires=" + h.toUTCString() : "";
            d += e.secure ? ";secure" : "";
            e = d.length + 1;
            4096 < e && a.warn("Cookie '" + b + "' possibly not set or overflowed because it was too large (" +
                e + " > 4096 bytes)!");
            k.cookie = d
        }
    }

    g.module("ngCookies", ["ng"]).provider("$cookies", [function () {
        var b = this.defaults = {};
        this.$get = ["$$cookieReader", "$$cookieWriter", function (a, f) {
            return {
                get: function (c) {
                    return a()[c]
                }, getObject: function (c) {
                    return (c = this.get(c)) ? g.fromJson(c) : c
                }, getAll: function () {
                    return a()
                }, put: function (c, a, n) {
                    f(c, a, n ? g.extend({}, b, n) : b)
                }, putObject: function (c, b, a) {
                    this.put(c, g.toJson(b), a)
                }, remove: function (a, k) {
                    f(a, l, k ? g.extend({}, b, k) : b)
                }
            }
        }]
    }]);
    g.module("ngCookies").factory("$cookieStore",
        ["$cookies", function (b) {
            return {
                get: function (a) {
                    return b.getObject(a)
                }, put: function (a, f) {
                    b.putObject(a, f)
                }, remove: function (a) {
                    b.remove(a)
                }
            }
        }]);
    m.$inject = ["$document", "$log", "$browser"];
    g.module("ngCookies").provider("$$cookieWriter", function () {
        this.$get = m
    })
})(window, window.angular);
65
//# sourceMappingURL=angular-cookies.min.js.map