代码拉取完成,页面将自动刷新
var mod = angular.module('app', ['ngRoute', 'ngAnimate', 'ngMessages', 'ngMaterial', 'route-segment', 'view-segment', 'app.nw-manifest', 'app.socket', 'ui.ace', 'ui.modal', 'ui.bootstrap', 'app.local-storage', 'app.top', 'app.game', 'app.game.creep', 'app.game.spawn', 'app.game.source', 'app.game.energy', 'app.game.construction-site', 'app.game.constructed-wall', 'app.game.exit', 'app.game.extension', 'app.game.flag', 'app.game.room.walls', 'app.game.room.roads', 'app.game.room.display-options-block', 'app.game.room.rendered-svg-path', 'app.game.room.view-popup', 'ui.bootstrap.tabs', 'app.game.memory', 'app.game.console', 'app.game.script', 'luegg.directives', 'app.connection', 'app.game.room', 'app.game.room.dlg-creep', 'app.dialogs', 'app.constants', 'app.game.tutorial', 'app.static-maps', 'app.memory-storage', 'app.game.editor-panel', 'app.game.replay-list', 'app.api', 'app.config', 'app.login', 'app.register', 'app.auth', 'app.loader', 'app.game.lobby', 'ngAria', 'app.game.room.dlg-flag', 'app.game.room.spawn-properties', 'app.game.room.creep-properties', 'ui.drop', 'app.profile', 'app.profile.account', 'app.key-filter', 'app.game.keeper-lair', 'app.game.portal', 'app.game.lobby.survival', 'app.game.lobby.arena', 'app.game.room.dlg-arena-activation', 'ui.json-editor', 'app.profile.account.badge', 'app.badge', 'app.badge.paths', 'app.game.world-map', 'app.game.controller', 'app.game.dlg-world-activation', 'app.game.dlg-world-respawn', 'app.profile.early-preview-request', 'app.game.overview', 'app.game.overview.room', 'app.punchcard', 'app.game.lobby.world', 'app.ea', 'app.game.room.controller-properties', 'app.game.room.lab-properties', 'app.game.link', 'app.game.room.flag-properties', 'app.timeline-stats', 'app.profile.messages.respondent', 'app.profile.messages.index', 'app.game.storage', 'app.game.script.dlg-clone-branch', 'app.profile.cpu', 'app.game.tower', 'app.game.observer', 'app.game.disabled-object', 'app.game.power-bank', 'app.game.power-spawn', 'app.game.lobby.power', 'app.profile-stats', 'app.recaptcha', 'app.profile.account.subscription', 'app.game.mineral', 'app.game.extractor', 'app.game.lab', 'app.game.terminal', 'app.game.container', 'app.game.tutorial.section1', 'app.game.tutorial.section2', 'app.game.tutorial.section3', 'app.game.tutorial.section4', 'app.game.tutorial.section5', 'angularSpectrumColorpicker', 'app.game.market', 'app.game.nuke', 'app.game.nuker', 'app.dlg-version-updated', 'app.code-branches', 'app.nw-local-file-sync', 'app.game.rampart', 'app.game.room.rampart-properties', 'app.game.market.all-orders', 'app.game.market.my-orders', 'app.game.market.history', 'app.dlg-server-message', 'app.game.shards', 'app.game.room.dlg-display-options', 'app.routing-app2', 'app.profile.account.auth-tokens', 'app.profile.account.auth-tokens.noratelimit', 'app.profile.account.runtime', 'app.game.room.effect-icon', 'app.game.room.power-creep-properties', 'app.game.room.deposit-properties', 'app.game.room.invaderCore-properties']);
mod.config(['$locationProvider', '$routeProvider', '$routeSegmentProvider', '$mdThemingProvider', '$compileProvider', function ($locationProvider, $routeProvider, $routeSegmentProvider, $mdThemingProvider, $compileProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.when('/order', { redirectTo: '/enter' });
$routeProvider.otherwise({ redirectTo: '/g' });
$mdThemingProvider.theme('default').dark().primaryColor('indigo', {
'hue-3': 'A400'
}).accentColor('teal', {
'default': '500'
}).warnColor('orange');
$mdThemingProvider.setDefaultTheme('default');
//$compileProvider.debugInfoEnabled(false);
if (1 || window.nw) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*((https?|ftp|file|blob|chrome-extension|steam):|data:image\/)/);
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|chrome-extension|steam):/);
}
}]);
mod.constant('uiAceConfig', {
ace: {
advanced: {
enableTern: {
defs: ['ecma5', 'ecma6', 'screeps'],
plugins: {
doc_comment: {
fullDocs: true
}
},
useWorker: true,
switchToDoc: function switchToDoc(name, start) {
console.log('switchToDoc called but not defined. name=' + name + '; start=', start);
},
startedCb: function startedCb() {}
},
/**
* when using tern, it takes over Ace's built in snippets support.
* this setting affects all modes when using tern, not just javascript.
*/
enableSnippets: true,
/**
* when using tern, Ace's basic text auto completion is enabled still by deafult.
* This settings affects all modes when using tern, not just javascript.
* For javascript mode the basic auto completion will be added to completion results if tern fails to find completions or if you double tab the hotkey for get completion (default is ctrl+space, so hit ctrl+space twice rapidly to include basic text completions in the result)
*/
enableBasicAutocompletion: true
}
}
});
mod.constant('AppInstanceId', new Date().getTime());
mod.constant('ResourceTypeNames', {
token: "subscription token",
energy: 'energy',
power: 'power',
H: 'hydrogen',
O: 'oxygen',
U: 'utrium',
L: 'lemergium',
K: 'keanium',
Z: 'zynthium',
X: 'catalyst',
OH: 'hydroxide',
ZK: 'zynthium keanite',
UL: 'utrium lemergite',
G: 'ghodium',
UH: 'utrium hydride',
UO: 'utrium oxide',
KH: 'keanium hydride',
KO: 'keanium oxide',
LH: 'lemergium hydride',
LO: 'lemergium oxide',
ZH: 'zynthium hydride',
ZO: 'zynthium oxide',
GH: 'ghodium hydride',
GO: 'ghodium oxide',
UH2O: 'utrium acid',
UHO2: 'utrium alkalide',
KH2O: 'keanium acid',
KHO2: 'keanium alkalide',
LH2O: 'lemergium acid',
LHO2: 'lemergium alkalide',
ZH2O: 'zynthium acid',
ZHO2: 'zynthium alkalide',
GH2O: 'ghodium acid',
GHO2: 'ghodium alkalide',
XUH2O: 'catalyzed utrium acid',
XUHO2: 'catalyzed utrium alkalide',
XKH2O: 'catalyzed keanium acid',
XKHO2: 'catalyzed keanium alkalide',
XLH2O: 'catalyzed lemergium acid',
XLHO2: 'catalyzed lemergium alkalide',
XZH2O: 'catalyzed zynthium acid',
XZHO2: 'catalyzed zynthium alkalide',
XGH2O: 'catalyzed ghodium acid',
XGHO2: 'catalyzed ghodium alkalide',
ops: 'ops',
silicon: 'silicon',
metal: 'metal',
biomass: 'biomass',
mist: 'mist',
utrium_bar: 'utrium bar',
lemergium_bar: 'lemergium bar',
zynthium_bar: 'zynthium bar',
keanium_bar: 'keanium bar',
ghodium_melt: 'ghodium melt',
oxidant: 'oxidant',
reductant: 'reductant',
purifier: 'purifier',
battery: 'battery',
composite: 'composite',
crystal: 'crystal',
liquid: 'liquid',
wire: 'wire',
switch: 'switch',
transistor: 'transistor',
microchip: 'microchip',
circuit: 'circuit',
device: 'device',
cell: 'cell',
phlegm: 'phlegm',
tissue: 'tissue',
muscle: 'muscle',
organoid: 'organoid',
organism: 'organism',
alloy: 'alloy',
tube: 'tube',
fixtures: 'fixtures',
frame: 'frame',
hydraulics: 'hydraulics',
machine: 'machine',
condensate: 'condensate',
concentrate: 'concentrate',
extract: 'extract',
spirit: 'spirit',
emanation: 'emanation',
essence: 'essence'
});
mod.run(['$routeSegment', '$rootScope', 'Socket', '$http', 'MemoryStorage', 'LocalStorage', 'Connection', 'Auth', 'Loader', '$mdAria', '$interval', '$document', '$injector', function ($routeSegment, $rootScope, Socket, $http, MemoryStorage, LocalStorage, Connection, Auth, Loader, $mdAria, $interval, $document, $injector) {
$rootScope.$routeSegment = $routeSegment;
$rootScope._ = _;
$rootScope.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
$rootScope.Me = function () {
return Auth.Me;
};
$rootScope.Loader = Loader;
$rootScope.Math = Math;
$rootScope.isOffServer = function () {
return $injector.get('Api').options.official;
};
$rootScope.isShards = function () {
return _.some($injector.get('Api').options.serverData.shards);
};
$rootScope.isMultiShard = function () {
var serverData = $injector.get('Api').options.serverData;
return serverData.shards && serverData.shards.length > 1;
};
if (LocalStorage.get('firstVisit', false, '') === false) {
var time = new Date().getTime();
LocalStorage.put('firstVisit', time, '');
}
$interval.bindToScope = function ($scope, fn, timeout) {
var interval = $interval(fn, timeout);
$scope.$on('$destroy', function () {
return $interval.cancel(interval);
});
};
$document.bindToScope = function (scope, event, fn) {
var applyFn = function applyFn(event) {
return scope.$apply(function () {
return fn(event);
});
};
$document.bind(event, applyFn);
scope.$on('$destroy', function () {
return $document.unbind(event, applyFn);
});
};
if (window.nw) {
$rootScope.nw = true;
var greenworks = require('./greenworks');
if (!greenworks.initAPI()) {
console.error('Could not init steamworks');
}
} else {
Loader.registerPre($injector.get('Api').get('version').then(function (data) {
$injector.get('Api').options.serverData = data.serverData;
}));
}
}]);
mod.directive('appShowWhenSteamOverlay', ['$animate', '$timeout', function ($animate, $timeout) {
return {
link: function link($scope, elm, attrs) {
var active = false,
timeout;
function forceRefresh() {
if (!active) {
return;
}
setTimeout(function () {
elm[0].getContext('2d').clearRect(0, 0, 1, 1);
window.requestAnimationFrame(forceRefresh);
}, 1000 / 30);
}
function update(isVisible) {
$animate[isVisible ? 'removeClass' : 'addClass'](elm, 'ng-hide');
active = isVisible;
if (active) {
forceRefresh();
if (timeout) {
$timeout.cancel(timeout);
timeout = null;
}
}
}
var greenworks = require('./greenworks');
greenworks.on('game-overlay-activated', function (isActive) {
return $scope.$apply(function () {
if (isActive) {
update(true);
} else {
if (timeout) {
$timeout.cancel(timeout);
}
timeout = $timeout(2000);
timeout.then(function () {
if (active) {
update(false);
}
});
}
});
});
$scope.$on('$destroy', function () {
return active = false;
});
}
};
}]);
mod.directive('appCustomValidator', function () {
return {
require: 'ngModel',
link: function link($scope, elm, attrs, ngModel) {
var info = $scope.$eval(attrs.appCustomValidator);
for (var key in info) {
if (info[key]().$$state) ngModel.$asyncValidators[key] = info[key];
}
for (var key in info) {
if (!info[key]().$$state) ngModel.$validators[key] = info[key];
}
}
};
});
mod.directive('appController', function () {
return {
controller: '@',
priority: -10000
};
});
mod.directive('appAutofocus', function () {
return {
link: function link($scope, elm, attrs) {
if (!attrs.appAutofocus || $scope.$eval(attrs.appAutofocus)) setTimeout(function () {
elm.focus();
}, 100);
}
};
});
mod.directive('appSubmit', ['$parse', function ($parse) {
return {
controller: ['$scope', '$attrs', function controller($scope, $attrs) {
var _this = this;
this.loadingCnt = false;
this.recaptchaWidgetId = null;
this.onSubmit = function (recaptcha) {
$scope.$apply(function () {
_this.loadingCnt = false;
var promise = $parse($attrs.appSubmit)($scope, { $recaptcha: recaptcha });
if (promise && promise.then) {
_this.loadingCnt = true;
promise.catch(function () {
$scope.$broadcast('form fail');
})['finally'](function () {
_this.loadingCnt = false;
});
}
});
};
}],
link: function link($scope, elm, attrs, ctrl) {
elm.submit(function (event) {
event.preventDefault();
if (ctrl.recaptchaWidgetId !== null) {
grecaptcha.reset(ctrl.recaptchaWidgetId);
$scope.$apply(function () {
ctrl.loadingCnt = true;
grecaptcha.execute(ctrl.recaptchaWidgetId);
});
} else {
ctrl.onSubmit();
}
});
}
};
}]);
mod.directive('appFormFailAnim', ['$animate', function ($animate) {
return {
link: function link($scope, elm, attrs) {
$scope.$on('form fail', function () {
$animate.addClass(elm, attrs.appFormFailAnim).then(function () {
return $animate.removeClass(elm, attrs.appFormFailAnim);
});
});
}
};
}]);
mod.directive('appSubmitAnimated', function () {
return {
require: '^appSubmit',
link: function link($scope, elm, attrs, ctrl) {
$scope.$watch(function () {
return ctrl.loadingCnt;
}, function (val) {
elm.toggleClass('striped', val);
val ? elm.attr('disabled', 'disabled') : elm.removeAttr('disabled');
});
}
};
});
mod.directive('appSubmitRecaptcha', ['Recaptcha', function (Recaptcha) {
return {
require: '^appSubmit',
link: function link($scope, elm, attrs, ctrl) {
if (Recaptcha.disabled) {
return;
}
$scope.$watch(function () {
return Recaptcha.loaded;
}, function (val) {
if (!val) {
return;
}
console.log('recaptcha loaded');
ctrl.recaptchaWidgetId = grecaptcha.render(elm[0], {
sitekey: '6Lc-Q0IUAAAAACrAWi56MDdxAjK98uiNO1klxDic',
theme: 'dark',
size: 'invisible',
badge: attrs.appSubmitRecaptcha || 'bottomright',
callback: function callback(token) {
console.log('recaptcha completed', token);
ctrl.onSubmit(token);
}
});
});
}
};
}]);
mod.directive('appFocusOnEvent', function () {
return {
link: function link($scope, elm, attrs) {
$scope.$on(attrs.appFocusOnEvent, function () {
setTimeout(function () {
elm.focus();
elm.find('input, textarea').focus();
}, 100);
});
}
};
});
mod.directive('appCursorToEndOnEvent', function () {
return {
link: function link($scope, elm, attrs) {
$scope.$on(attrs.appCursorToEndOnEvent, function () {
if (elm.get(0).setSelectionRange) {
elm.get(0).setSelectionRange(elm.val().length, elm.val().length);
}
});
}
};
});
mod.directive('appStopClickPropagation', function () {
return function ($scope, element, attrs) {
element.click(function (e) {
if (attrs.appStopClickPropagation.charAt(0) == "~") {
var m = attrs.appStopClickPropagation.match(/^~(.*)$/);
if (!m[1] || $scope.$eval(m[1])) {
e.stopImmediatePropagation();
}
} else if (attrs.appStopClickPropagation == "" || $scope.$eval(attrs.appStopClickPropagation)) e.stopPropagation();
});
};
});
mod.directive('appStopPropagation', function () {
return function ($scope, element, attrs) {
element.bind(attrs.appStopPropagation, function (e) {
e.stopPropagation();
});
};
});
mod.directive('appClickAnimated', ['$parse', function ($parse) {
return {
scope: true,
link: function link($scope, element, attrs) {
element.bind('click', function (event) {
element.addClass('striped');
element.attr('disabled', 'disabled');
$scope.$apply(function () {
var resultPromise = $parse(attrs.appClickAnimated)($scope, { $event: event });
resultPromise['finally'](function () {
element.removeClass('striped');
if (attrs.ngDisabled) {
var value = $scope.$eval(attrs.ngDisabled);
value ? element.attr('disabled', 'disabled') : element.removeAttr('disabled');
} else element.removeAttr('disabled');
});
});
});
}
};
}]);
mod.directive('appOnCtrlEnter', function () {
return {
link: function link($scope, elm, attrs) {
elm.find('textarea').keydown(function (event) {
if ((event.ctrlKey || event.shiftKey) && event.keyCode == 13 || event.ctrlKey && event.keyCode == 83) {
event.preventDefault();
$scope.$apply(function () {
return $scope.$eval(attrs.appOnCtrlEnter);
});
}
});
}
};
});
mod.directive('appFacebookParse', ['$timeout', function ($timeout) {
return {
link: function link($scope, elm, attrs) {
$timeout(function () {
FB.XFBML.parse();
}, 10);
}
};
}]);
mod.directive('appAutoScrollWatch', function () {
return {
priority: 100000,
link: function link($scope, elm, attrs) {
var boundToBottom = 0;
$scope.$watch(attrs.appAutoScrollWatch, function () {
if (boundToBottom !== null) {
setTimeout(function () {
elm[0].scrollTop = elm[0].scrollHeight - elm.height() - boundToBottom;
if (boundToBottom) boundToBottom = 0;
}, 0);
}
});
elm.scroll(function () {
if (boundToBottom === 0 || boundToBottom === null) {
boundToBottom = elm[0].scrollTop == elm[0].scrollHeight - elm.height() ? 0 : null;
}
});
$scope.$on('save scroll', function () {
boundToBottom = elm[0].scrollHeight - elm.height() - elm[0].scrollTop;
});
}
};
});
mod.directive('appEnterSubmit', function () {
return {
link: function link($scope, elm) {
elm.keydown(function (event) {
if (event.keyCode == 13 && event.ctrlKey) {
$(elm.get(0).form).submit();
event.preventDefault();
}
});
}
};
});
mod.directive('appClickSelectAll', function () {
return {
link: function link($scope, elm, attrs) {
elm.click(function () {
return elm[0].select();
});
}
};
});
mod.directive('appButtonCopyInput', function () {
return {
link: function link($scope, elm, attrs) {
elm.find('button').click(function () {
elm.find('input')[0].select();
document.execCommand('copy');
});
}
};
});
mod.directive('appNwExternalLink', function () {
return {
link: function link($scope, elm, attrs) {
if (!window.nw) {
return;
}
elm.click(function (e) {
nw.Shell.openExternal(attrs.appNwExternalLink || elm.attr('href'));
e.preventDefault();
});
}
};
});
mod.filter('empty', function () {
return function (val) {
if (_.isObject(val)) {
if (_.isArray(val)) return val.length == 0;else {
for (var i in val) {
if (!_.isFunction(val[i]) && val[i] !== null && val[i] !== undefined) return false;
}return true;
}
}
return val === null || val === undefined;
};
});
mod.filter('keys', function () {
return function (value) {
return _.keys(value);
};
});
mod.filter('sort', function () {
return function (value) {
return value.sort();
};
});
mod.filter('trust', ['$sce', function ($sce) {
return function (val) {
return $sce.trustAsHtml(val);
};
}]);
mod.filter('bust', function () {
return function (val) {
return val + '?bust=__bust__';
};
});
mod.filter('readableDate', ['$locale', function ($locale) {
return function (value) {
var now = new Date();
var time = new Date(value);
var today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
if (time.getTime() > now.getTime() - 60 * 1000) return 'Just now';
if (time.getTime() > now.getTime() - 3600 * 1000) {
var minutesAgo = Math.round((now.getTime() - time.getTime()) / 1000 / 60);
return minutesAgo + (minutesAgo != 1 ? ' minutes ago' : ' minute ago');
}
if (time.getTime() >= today.getTime()) return 'Today at ' + time.toLocaleTimeString();
if (time.getTime() > new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1, 0, 0, 0).getTime()) return 'Yesterday at ' + time.toLocaleTimeString();
if (time.getTime() > new Date(now.getFullYear(), now.getMonth(), now.getDate() - 4, 0, 0, 0).getTime()) {
var days = Math.round((today.getTime() - new Date(time.getFullYear(), time.getMonth(), time.getDate(), 0, 0, 0)) / 24 / 3600 / 1000);
return days + ' days ago';
}
return time.toLocaleDateString();
};
}]);
mod.factory('$mdAria', function () {
return {
expect: angular.noop,
expectWithText: angular.noop
};
});
mod.filter('pad', function () {
return function (val) {
if (val < 10) return '0' + val;
return val;
};
});
mod.filter('round', function () {
return function (val) {
val = Math.round(val | 0);
var log = Math.floor(Math.log10 ? Math.log10(val) : Math.log(val) / Math.LN10 + 0.00000001),
log3 = Math.floor(log / 3),
round = 100;
if (log > 3) {
if (log - log3 * 3 > 0) {
round = 10;
}
if (log - log3 * 3 > 1) {
round = 1;
}
val = Math.floor(val / Math.pow(10, 3 * log3) * round) / round;
val = "" + val;
if (val.length < 3 && !/\./.test(val)) {
val += ".0";
}
val += { 0: '', 1: 'K', 2: 'M', 3: 'B' }[log3];
}
return "" + val;
};
});
mod.filter('marked', ['$sce', function ($sce) {
function unescape(html) {
// explicitly match decimal, hex, and named HTML entities
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function (_, n) {
n = n.toLowerCase();
if (n === 'colon') return ':';
if (n.charAt(0) === '#') {
return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
}
return '';
});
}
var renderer = new marked.Renderer();
renderer.link = function (href, title, text) {
if (this.options.sanitize) {
try {
var prot = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
} catch (e) {
return '';
}
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
return '';
}
}
var out = '<a href="' + href + '"';
if (title) {
out += ' title="' + title + '"';
}
out += 'onclick="if(window.nw) {nw.Shell.openExternal(this.href); return false;}">' + text + '</a>';
return out;
};
var options = _.extend({}, marked.defaults, { breaks: true, sanitize: true, code: true, renderer: renderer });
var lexer = new marked.Lexer(options);
var parser = new marked.Parser(options);
return function (value) {
value = parser.parse(lexer.lex(value));
return $sce.trustAsHtml(value);
};
}]);
mod.filter('truncate', function () {
return function (value, length) {
if (value.length <= length) {
return value;
}
return value.substring(0, length) + '...';
};
});
mod.filter('elapsedDays', function () {
function pad(val) {
if (val < 10) return '0' + val;
return val;
}
var filter = function filter(value) {
var elapsed = value - Date.now();
if (elapsed < 0) {
return null;
}
if (elapsed > 48 * 3600 * 1000) {
return Math.floor(elapsed / 24 / 3600 / 1000) + ' days';
} else {
return pad(Math.floor(elapsed / 60 / 60 / 1000)) + ':' + pad(Math.floor(elapsed / 60 / 1000) % 60) + ':' + pad(Math.floor(elapsed / 1000) % 60);
}
};
filter.$stateful = true;
return filter;
});
mod.filter('capitalize', function () {
return function (value) {
return value.charAt(0).toUpperCase() + value.slice(1);
};
});
mod.directive('appSpectrum', function () {
return {
link: function link($scope, elm, attrs) {
$(elm).spectrum({
preferredFormat: "hex",
showInput: true
});
$(elm).on('change.spectrum', function () {
return $scope.$apply();
});
}
};
});
mod.directive('appVisible', ['$animate', function ($animate) {
return {
restrict: 'A',
link: function link(scope, element, attr) {
scope.$watch(attr.appVisible, function (value) {
$animate[value ? 'removeClass' : 'addClass'](element, 'invisible');
});
}
};
}]);
mod.directive('appAttr', function () {
return {
link: function link($scope, elm, attrs) {
var m = attrs.appAttr.split('#');
$scope.$watch(m[1], function (val) {
return elm[0].setAttribute(m[0], val);
});
}
};
});
mod.directive("appFileInput", function () {
return {
require: "ngModel",
link: function postLink($scope, elem, attrs, ngModel) {
elem.on("change", function (e) {
var files = elem[0].files;
ngModel.$setViewValue(files);
});
$scope.$on('appFileDrop', function (event, files) {
console.log('drop', files);
ngModel.$setViewValue(files);
});
}
};
});
mod.directive('appFileDrop', function () {
return function ($scope, elm, attrs) {
elm.addClass('file-drop');
elm.on('dragenter', function (e) {
e.stopPropagation();
e.preventDefault();
elm.addClass('file-drop--active');
});
elm.on('dragover', function (e) {
e.stopPropagation();
e.preventDefault();
elm.addClass('file-drop--active');
});
elm.on('dragexit dragleave', function (e) {
elm.removeClass('file-drop--active');
});
elm.on('drop', function (e) {
e.stopPropagation();
e.preventDefault();
elm.removeClass('file-drop--active');
if (e.originalEvent.dataTransfer) {
$scope.$apply(function () {
$scope.$broadcast('appFileDrop', e.originalEvent.dataTransfer.files);
});
}
});
};
});
mod.filter('routeSegmentUrlStateless', ['$routeSegment', function ($routeSegment) {
var filter = function filter(segmentName, params) {
return $routeSegment.getSegmentUrl(segmentName, params);
};
// this is the only change from standard routeSegmentUrl:
// filter.$stateful = true;
return filter;
}]);
angular.module('ngAria', []);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。