Iam facing problem with ng-smartBanner,unable to see banner with respect to device,It is showing directly the binded text.
JavaScript:
var myAppModule = angular.module('myApp', ['ng-smartBanner'])
.config(function(BannerOptionsProvider){
BannerOptionsProvider.setBannerOptions(
{
title: 'toto', // What the title of the app should be in the banner
(defaults to <title>)
author: "toto gro", // What the author of the app should be in the banner (defaults to <meta name="author"> or hostname)
price: '1 milion de dollar', // Price of the app
icon: 'icon-app.png', // The URL of the icon (defaults to <meta name="apple-touch-icon">)
button: 'TELECHARGER', // Text for the install button
urlStore: 'http://www.google.de', // The URL for the button. Keep null if you want the button to link to the app store.
scale: 'auto', // Scale based on viewport size (set to 1 to disable)
speedIn: 300, // Show animation speed of the banner
speedOut: 400, // Close animation speed of the banner
daysHidden: 15, // Duration to hide the banner after being closed (0 = always show banner)
daysReminder: 90, // Duration to hide the banner after "VIEW" is clicked *separate from when the close button is clicked* (0 = always show banner)
force: 'ios' // Choose 'ios', 'android' or 'windows'. Don't do a
browser check, just always show this banner
}
);
});
// configure the module.
// in this example we will create a greeting filter
myAppModule.filter('greet', function() {
return function(name) {
return 'Hello, ' + name + '!';
};
});
Here is my plunker link: Plunker
Related
I have an image cropper overlay that is being displayed for a media item selected from a media picker. I am able to display the media item and make changes to its crops just fine, but I am not sure how I go about saving my changes.
This is the overlay in question, without the saving functionality:
$scope.remove = function (index) {
$scope.overlay = {
mediaId: $scope.images.udi,
saving: false,
show: true, //controls whether to show the overlay or not
value: $scope.images[0].metaData.umbracoFile.Value,
config: $scope.images[0].metaData.umbracoFile.Value,
view: '/App_Plugins/Our.Umbraco.OutCrop/cropper.html',
close: function (oldModel) { //when the overlay is closed, dont show
$scope.overlay.show = false;
},
title: 'Image Crops',
submitButtonLabel: 'Save Crops',
submit: function (model) { //when user clicks save crops button
$scope.overlay.saving = true;
$scope.overlay.show = false;
//do savings...
}
}
When i press the submit button I need to have the new crops saved to the media item. The values the overlay uses to display the current crops are located in the "metaData.umbracoFile.Value" of the image. Only a single image is able to be selected.
I am working in a Sencha Touch app with different Toasts to show messages like "successful" or "info" etc.. but I am having random behavior, for example:
1º if you navigate for the application tapping in a one action with Toast and you navigate to other screen while Toast is up, toast has a random behavior getting the last color instead of change..( in the test case with the same color but with different message, please you can read the code)
2º Sometimes Toast is not appearing and I do not have explanation.
Any suggestion about the code? currently it is a singleton class, and it is called from other parts/controllers of the app depending the action.
On the other hand, any other approach with a similar behavior? maybe it is needed to change the strategy and no use Toasts..
It is happening in Windows 8 and iOS and I am using 2.4.1 version, reading the release notes of 2.4.2 has not news about this element of the framework, and I guess is not relevant to update to the latest framework version.
Here my Toast Manager class:
/**
* Loading popup as a static-functions class
*
* Different toast-messages colors:
* 0 --> green
* 1 --> orange
* 2 --> red
*
* We create a config object and depending of the status we show a Toast
*/
Ext.define('xx.view.components.ToastManager', {
singleton : true,
requires : [
'Ext.Toast'
],
config : {
toastOptions: {
message : '',
centered : false,
width : 200,
height : 100,
bottom : '10%',
modal : false,
right : 10,
style : '',
type : 'slide', duration: 850, easing: 'ease-out',
hideAnimation: {type: 'fadeOut', duration: 650, easing: 'ease-out'},
timeout : 3000
},
toastComponent : null,
t : null
},
constructor : function () {
this.initConfig();
},
changeVisibility: function() {
if(this.getT()) {
clearTimeout(this.getT());
}
var toastes = Ext.query('.x-toast');
for(var i = 0; i < toastes.length; i++) {
Ext.get(toastes[i]).setStyle('visibility', 'visible');
}
var t = setTimeout(function() {
var toastes = Ext.query('.x-toast');
for(var i = 0; i < toastes.length; i++) {
Ext.get(toastes[i]).setStyle('visibility', 'hidden');
}
}, 4000);
this.setT(t);
},
/**
* Shows a successful message
* #param label
* #param status
*/
showToastMessage : function (label, status) {
var options = this.getToastOptions();
options.message = label;
switch (status) {
case 0:
options.style = 'background-color: #30B420';
break;
case 1:
options.style = 'background-color: #FFA500';
break;
case 2:
options.style = 'background-color: #ff0000';
break;
default:
options.message = "?"
}
this.changeVisibility();
this.setToastComponent(Ext.toast(this.getToastOptions()));
}
});
I'm using this function for my toast messages (in ExtJS though):
showToastMessage: function(message, alignTo){
Ext.toast({
cls: 'toast-window',
header: false,
html : '<div class="toast">' + message + '</div>',
animate: true,
slideInAnimation: 'ease',
slideInDuration: 300,
slideOutDuration: 200,
autoCloseDelay: 1500,
align: alignTo ? alignTo : 't'
});
}
You can apply some css to toast-window and toast classes to make you message look nice.
You just pass your message to this function and it should show a nice toast!
I try to implement a way to prevent the updating of values with mouse (actually when the three.js animation has started, launched with a click on button).
For the moment, I have the following dat.GUI menu:
Once "start" button is clicked, I would like to prevent user from modifying with mouse the parameters "Rotation x" and "Rotation y".
Here is the concerned part of code for this menu:
// Create GUI
var gui = new dat.GUI({
autoplace: false,
width: 350,
height: 9 * 32 - 1
});
var params = {
GreatCircle : '',
Rotationx : torusRotationInitX,
Rotationy : torusRotationInitY,
StartingVector : '',
ComponentVectorTheta : 15.0,
ComponentVectorPhi : 15.0,
CovariantDerivativeVector : '',
ComponentCovariantDerivativeTheta : 15.0,
ComponentCovariantDerivativePhi : 15.0
};
// Set parameters for GUI
gui.add(params, 'GreatCircle').name('Great Circle ');
controllerRotationx = gui.add(params, 'Rotationx', 0, 2*Math.PI, 0.001).name('Rotation x ');
controllerRotationy = gui.add(params, 'Rotationy', 0, 2*Math.PI, 0.001).name('Rotation y ');
...
When I click on reset button, I call the following function:
// Reset Button
resetButton.onclick = function ResetParameters() {
...
// Reinitialize parameters into gui
params.Rotationx = torusRotationInitX;
params.Rotationy = torusRotationInitY;
for (var i in gui.__controllers) {
gui.__controllers[i].updateDisplay();
}
render();
}
I don't know if there is an option for controller to lock these sliders which usually change their values. Is it possible?
Update 1
Maybe I could wrapper the dat.GUI menu into a div and make this div not clickable, is it a solution?
Update 2
I tried to apply the method used on Method for disabling a button in dat.gui?
Following this solution, I have added the extension into dat.gui, just after:
dat.controllers.FunctionController = (function (Controller, dom, common) {
...
});
The following added code snippet is:
function blockEvent(event)
{
event.stopPropagation();
}
Object.defineProperty(dat.controllers.FunctionController.prototype, "disabled", {
get: function()
{
return this.domElement.hasAttribute("disabled");
},
set: function(value)
{
if (value)
{
this.domElement.setAttribute("disabled", "disabled");
this.domElement.addEventListener("click", blockEvent, true);
}
else
{
this.domElement.removeAttribute("disabled");
this.domElement.removeEventListener("click", blockEvent, true);
}
},
enumerable: true
});
Is extension code well located into dat.GUI source?
Then, I set the property "disabled" into my code to prevent user from sliding "controllerRotationx" with mouse (once start button is pressed):
if (animation)
controllerRotationx.__li.disabled = true;
Unfortunately, my method doesn't work : when animation is started, I can still move the slider contained into "controllerRotationx".
I saw that above link (Method for disabling a button in dat.gui?), this was about a button and not for a slider, does it change anything for my case?
I didn't find an explicit controller for the slider.
I would do this. The slider is not a form element, there's nothing to disable in the traditional w3c sense. Luckily we can use pointer-events and disable it properly as if it were a form element using just public dat.gui properties.
var speeder = menu.add(text, 'speed', -5, 5);
speeder.domElement.style.pointerEvents = "none"
speeder.domElement.style.opacity = .5;
The solution given by #Radio works pretty well. But, with sliders, the slider is a sibling of the text box's DOM element. We need to disable pointer events on the div which contains all the controls (and which is not exposed directly by dat.gui). So,
var speeder = menu.add(text, 'speed', -5, 5);
// disables the text box
speeder.domElement.style.pointerEvents = "none"
// disables all controller elements related to "speeder"
speeder.domElement.parentElement.style.pointerEvents = 'none'
When the Start button is pressed, set:
controllerRotationx.__li.setAttribute( "style", "display: none" );
thanks for tips
on my side i hack the Common controller
so able to chainning.
gui.add(this, '_screenW').disable(true);
Common.extend(controller, {
disable: function disable(v) {
this.domElement.style.pointerEvents = v?"none":"auto";
this.domElement.style.opacity = v?.5:1;
return controller;
},
I am using flowplayer with Javascript plugins for my mp3 file based site. Now everything is working except the progress bar and buffering. The buffer div is only have a width of 451px as my track div as got a custom width (I have given in CSS) of 903px. When I click on the play button the progress div will go full width that is 451px. There is no problem with the playback. When I supply a duration say as 402 or something, then the progress bar and playhead starts moving from the start point as desired. So I think this may be an issue with calculating the duration of the mp3 file. Please let me know how this can be fixed.
My code is like this
<div id="audio" style="display:block;height: 0px;visibility: hidden"></div>
<div id="footer" class="footer"></div>
window.onload = function(){
$f("audio", "swf/flowplayer-3.2.7.swf", {
// don't start automatically
clip: {
autoPlay: false,
autoBuffering: true,
duration:430,
baseUrl: 'http://localhost/gaanaOnline/gaanaonline',
onFinish: function() {
setTimeout('player_next()',100);
}
},
onLoad: function() {
load_clips();
},
// disable default controls
plugins: {
audio: {
url: 'swf/flowplayer.audio-3.2.2.swf'
},
controls: null
}
// install HTML controls inside element whose id is "hulu"
}).controls("footer", {
// CSS class name for the playhead
playHeadClass: 'playhead',
// CSS class name for the track
trackClass: 'track',
// CSS class name for the playhead when in a playing state
playClass: 'play',
// CSS class name for the playhead when in a paused state
pauseClass: 'pause',
// CSS class name for the buffer bar
bufferClass: 'buffer',
// CSS class name for the progress bar
progressClass: 'progress',
// CSS class name for the time display
timeClass: 'time',
// CSS class name for mute button
muteClass: 'mute',
// CSS class name for the unmute button
unmuteClass: 'unmute',
// a default duration for the time display in seconds
duration: 0
});
};
If it is an issue with the duration of mp3 file, please advice me how to calculate it in JS and supply to the player.
EDIT: I have added the screenshot below:
This code working for me to display the door-hanger popup. But, when I want to use the time-out under the options it wont show up the pop-up notification.
Syntax:
Notification show(browser,id,message,anchorID,mainAction,secondaryActions,options);
My code:
PopupNotifications.show(gBrowser.selectedBrowser, "PDE-popup",
"Hi, there!, You can Build a PaDE by clicking on the PDE button!!",
null, /* anchor ID */
{
label: "Build PDE",
accessKey: "D",
callback: function() {
if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC);
window.openDialog("chrome://PDE/content/PDEBuilder.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC);
}
},null, { timeout: Date.now() + 10000,
persistWhileVisible: false });
1.What's wrong with this code?
2. How can I place this door hanger popup to be displayed on my tool bar button?
This is the tool bar button
<toolbarbutton id="pde-toolbar-button" label="Detect"/>
I want to disappear the pop-up notification in 10Seconds! Thank u guys.
I have no secondary options so, I made it null but the time-out is not functioning.
http://scenari-platform.org/svn/dev-core/trunk/Lib_XulRunner/Darwin/modules/PopupNotifications.jsm
https://developer.mozilla.org/en/JavaScript_code_modules/PopupNotifications.jsm#Notification_events
Components.utils.import('resource://app/modules/PopupNotifications.jsm');
var notify = new PopupNotifications(gBrowser,
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"));
var notification = notify.show(
gBrowser.selectedBrowser, /*browser*/
"PDES-popup", /*id*/
"Hi, there!, You can Build a PDE by clicking on the PDE button!!",/*message*/
null, /* anchor ID */
/* mainAction */
{
label: "Build PDE",
accessKey: "D",
callback: function() {
if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC);
window.openDialog("chrome://PDE/content/PDESBuilder.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC);
}
},
null, /* secondaryActions*/
{ blablal:'options'}
);
setTimeout(function(){
notification.remove();
}, 900);
The above code works fine, finally got a clear explanation from other forum for my problem.