Firefox- Extension - How to make a sidebar - javascript

Can anybody tell me how to make a sidebar. There is nothing about sidebar in the XUL reference. I referred some old codes. But, I can't get where to edit. In those codes I have to create jar files frequently which annoys a lot. Can anybody show me a guidance, just a simple code to add a listbox in sidebar?
Edit:
This code works. I edited the code in "emptysidebar.xul". But it didn't work.
Any solution to add elements in sidebar is welcomed.

I didnt even dreamt that the solution will be this much simple. This is the solution.
var sidebarWindow = document.getElementById("sidebar").contentWindow;
if(sidebarWindow)
{
sidebarWindow.location = "chrome://custombutton/content/login.xul";
// your xul location
}
else
{
alert("sidebar window is not null");
}

Related

Header appears on scroll?

I was working on a project that had a different header appear for when the page is scrolled past the main one.
Here's a fiddle with my code:
https://jsfiddle.net/a7tLdsov/3/
Could anyone explain how to make this work? I thought that this js would make it work but it still isn't quite there.
Thanks,
:)
Try making these changes:
Change
$("body").scroll
to
$(window).scroll
and change
document.getElementById('transhead').style.display = "visible";
to
document.getElementById('transhead').style.display = "block";
Make sure jQuery is added as a framework in your fiddle.
Updated fiddle: https://jsfiddle.net/hba9twcd/

How to fill a div that is loaded from another html page

I'm trying to load a div from another html page, then fill it with values from my main html page.
My div is correctly loaded and displayed, but it seems like it doesn't want to fill up. Here's what I have so far :
$("#valider").click(function() {
$("#ag_pub_panneau_detail_html").load( "https://tc610/ag_pub_collecte/Ag_pub_panneau_detail.html #ag_pub_panneau_detail_master_div");
$("#ag_pub_panneau_detail_html").show();
});
So when I click on the "valider" button, my div is loaded and displayed, so far so good.
And here's where I'm struggling, I tried this :
if ($('ag_pub_panneau_detail_html').is(':visible')) {
$('#ag_pub_panneau_entityid').val($('#ag_id_panneau').val());
}
but the div stays blank. So I tried this instead :
$("#valider").click(function() {
$("#ag_pub_panneau_detail_html").load( "https://tc610/ag_pub_collecte/Ag_pub_panneau_detail.html #ag_pub_panneau_detail_master_div", fillDiv());
$("#ag_pub_panneau_detail_html").show();
});
function fillDiv(){
$('#ag_pub_panneau_entityid').val($('#ag_id_panneau').val());
}
But I get the same result. So I tried something else :
$("#valider").click(function() {
$("#ag_pub_panneau_detail_html").load( "https://tc610/ag_pub_collecte/Ag_pub_panneau_detail.html #ag_pub_panneau_detail_master_div");
$("#ag_pub_panneau_detail_html").show();
$('#ag_pub_panneau_entityid').val($('#ag_id_panneau').val());
});
I was thinking that since the .show() works well, I could add my line below it, but it doesn't seem to execute either.
So I used to think that this line :
$('#ag_pub_panneau_entityid').val($('#ag_id_panneau').val());
Was wrong but when I execute it from the Chrome console, the field is correctly filled... I don't know what's happening, and I'm out of ideas for my issue.
Is there something I'm doing wrong ?
I can provide more code/details if you want to, just ask me
Any help would be greatly appreciated !
I managed to get it working, what I did is that I created a js file for the Ag_pub_panneau_detail.html page (the one that is loaded) in which I just wrote :
$(document).ready(function()
{
$('#ag_pub_panneau_entityid').val(localStorage.getItem("ag_pub_panneau_entityid"));
});
And now it works like a charm :)
By the way, can I know why I have those downvotes on my question ?
Anyway thanks for your help !

$ionicScrollDelegate.scrollTop() doesn't allow me to scroll up manually after it scrolls down my list

I have a problem with using $ionicScrollDelegate.scrollTop()
I need to scroll down my book list to appropriate book after going out from the reader. I desided to use $ionicScrollDelegate.scrollTop() for this purpose.
It works, but I cannot scroll up my list manually after that.
Maybe someone knows why it happens.
Here is my code:
$timeout(function(){
var BooksListScroll = $ionicScrollDelegate.$getByHandle('BooksListScroll');
$location.hash("main" + $rootScope.currentBookCode);
BooksListScroll.scrollTop(true);
}, 500);
If you are using android platform to do a test, remove the 'true' value on the function. Ex:
BooksListScroll.scrollTop(true);
to
BooksListScroll.scrollTop();
Do a try.. IOS is working fine with the scroll animation but on android the scroll animation make the view freeze! Weird! :(
UPDATE (SOLUTION):
Okay I found the solution.. It seem we need to set 'jsScrolling: true' instead of by default is 'jsScrolling: false' for android.
Please modified/edit this on 'ionic-angular.js'
Hope it help others :)

Override js-events

It's a long shot which is not that investigated yet, but I'm throwing the question while I'm looking for answers to hopefully get on the right track.
Building a Wordpress site with the theme Dante. This has an image slider function for products, handled in jquery.flexslider-min.js. In my first attempt i used wp_dequeue_script( 'sf-flexslider' ); to stop using this, and then added my own js which works perfect. The problem, however, is that in the bottom of the page there's another slider for displaying other products that uses this file, so i can not simply just dequeue this script.
I've tried to put my js-file both before and after the jquery.flexslider-min.js but this is always the primary. It there a way to, in my js-file, do something like "for obects in [specified div], skip instructions from jquery.flexslider-min.js"?
EDIT: Found this thread and tried the .remove() and the .detach() approach and add it again, but this makes no difference.
I really want to get rid of that flexslider on this particullar object. I can, of course, "hack" the output and give the flexslider item another class or something, but that would bring me so much work i don't have time for.
Maybe, You can monkey patch the flexslider behavior. There's a good tutorial here:
http://me.dt.in.th/page/JavaScript-override/
Something like:
var slider = flexSlider;
var originalSlide = slider.slide;
slider.slide= function() {
if ( some condition) {
// your custom slide function
} else {
// use default behavior
originalSlide.apply(this, arguments);
}
}

onclick issues with dijit.Tooltip

I am facing following issue. I have attached tooltips with some tab titles of a dijit.TabContainer. The hover behavior is OK, but when I click on the tab, the tooltip stays visible unless I click somewhere else on the page.
On googling I got following page discussing this issue. http://ahackersnotes.com/web/hide-dojo-tooltip-after-a-mouse-click-by-extending-dijittooltip.html.
But the solution provided there didn't seem to work (at least in my case). Is there some other solution (may be a subclass solution) which could handle this?
I think I figured out one solution as follows:
dojo.provide("my.Tooltip");
dojo.require("dijit.Tooltip");
dojo.declare("my.Tooltip" , [ dijit.Tooltip ] ,
{
_onFocus: function(/*Event*/ e){
this.inherited(arguments);
this._focus = false;
}
});
Its working for me. I don't know for sure if it can cause any other problem in the tooltips.

Categories

Resources