Skip to content

Calculating position from class styles #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ temp

_SpecRunner.html

.grunt
.grunt
.idea
18 changes: 12 additions & 6 deletions angular-busy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ angular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',functi
tracker.durationPromise = $timeout(function(){
tracker.durationPromise = null;
},parseInt(options.minDuration,10) + (options.delay ? parseInt(options.delay,10) : 0));
}
}
};

tracker.isPromise = function(promiseThing){
var then = promiseThing && (promiseThing.then || promiseThing.$then ||
(promiseThing.$promise && promiseThing.$promise.then));

return typeof then !== 'undefined';
return typeof then !== 'undefined';
};

tracker.callThen = function(promiseThing,success,error){
Expand All @@ -57,7 +57,7 @@ angular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',functi
} else if (promiseThing.denodeify){
promise = $q.when(promiseThing);
}

var then = (promise.then || promise.$then);

then.call(promise,success,error);
Expand Down Expand Up @@ -100,8 +100,8 @@ angular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',functi
}
return tracker.promises.length > 0;
} else {
//if both delay and min duration are set,
//we don't want to initiate the min duration if the
//if both delay and min duration are set,
//we don't want to initiate the min duration if the
//promise finished before the delay was complete
tracker.delayJustFinished = false;
if (tracker.promises.length === 0) {
Expand All @@ -125,7 +125,13 @@ angular.module('cgBusy').directive('cgBusy',['$compile','$templateCache','cgBusy
link: function(scope, element, attrs, fn) {

//Apply position:relative to parent element if necessary
var position = element.css('position');
var position = '';
if (typeof window.getComputedStyle === 'function'){
position = window.getComputedStyle(element[0]).position;
}
if (!position) {
position = element.css('position');
}
if (position === 'static' || position === '' || typeof position === 'undefined'){
element.css('position','relative');
}
Expand Down
18 changes: 12 additions & 6 deletions dist/angular-busy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ angular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',functi
tracker.durationPromise = $timeout(function(){
tracker.durationPromise = null;
},parseInt(options.minDuration,10) + (options.delay ? parseInt(options.delay,10) : 0));
}
}
};

tracker.isPromise = function(promiseThing){
var then = promiseThing && (promiseThing.then || promiseThing.$then ||
(promiseThing.$promise && promiseThing.$promise.then));

return typeof then !== 'undefined';
return typeof then !== 'undefined';
};

tracker.callThen = function(promiseThing,success,error){
Expand All @@ -57,7 +57,7 @@ angular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',functi
} else if (promiseThing.denodeify){
promise = $q.when(promiseThing);
}

var then = (promise.then || promise.$then);

then.call(promise,success,error);
Expand Down Expand Up @@ -100,8 +100,8 @@ angular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',functi
}
return tracker.promises.length > 0;
} else {
//if both delay and min duration are set,
//we don't want to initiate the min duration if the
//if both delay and min duration are set,
//we don't want to initiate the min duration if the
//promise finished before the delay was complete
tracker.delayJustFinished = false;
if (tracker.promises.length === 0) {
Expand All @@ -125,7 +125,13 @@ angular.module('cgBusy').directive('cgBusy',['$compile','$templateCache','cgBusy
link: function(scope, element, attrs, fn) {

//Apply position:relative to parent element if necessary
var position = element.css('position');
var position = '';
if (typeof window.getComputedStyle === 'function'){
position = window.getComputedStyle(element[0]).position;
}
if (!position) {
position = element.css('position');
}
if (position === 'static' || position === '' || typeof position === 'undefined'){
element.css('position','relative');
}
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-busy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.