Joomla Multiple Domain names for one Joomla Install - joomla

I am using this article here to have two domains names point to the same Joomla install, with one having a different home page.
http://docs.joomla.org/Multiple_Domains_and_Web_Sites_in_a_single_Joomla!_installation
(option 2)
The sites open okay, and the second domain even goes to the correct landing page. The issue is that when on the second domain, all menu links open in a new window(they are relative links, but in the html it is adding "target=_blank") and i am not sure why, or how to stop it.
All the menu links properly open in the parent window when on the primary domain.
here are the two live links:
http://www.hustoninsurance.com/
http://tiffinhealthexchange.com/
Thanks in advance.
Running Joomla 3.0

I looked at the page source of tiffinhealth, and there is a function specialtrack() which is adding the target="_blank"
var specialtrack = new (function() {
[...]
var initialize = function() {
var links = document.links;
for (var i = 0, l = links.length; i < l; i++) {
var match = links[i].pathname.match(whitelist);
var match_links = links[i].href.match(domain);
var match_void = links[i].href.match('javascript:void');
if (typeof match_void == 'undefined' || match_void == null) {
if (typeof match !== 'undefined' && match !== null) {
links[i].addEventListener('click',trackpush_downloads,false);
links[i].setAttribute('target', '_blank');
}else if (typeof match_links == 'undefined' || match_links == null) {
links[i].addEventListener('click',trackpush_links,false);
links[i].setAttribute('target', '_blank');
}
}
}
};
The line links[i].setAttribute('target', '_blank'); is the one to blame for adding the target="_blank"; you should investigate with the developer or try to use an alternative solution to serve your purpose; maybe you could also avoid using two tracking on the same page.
Also, in your source you have plenty of absolute urls including the domain name: make sure this is consistent across the two domains otherwise page cache will eventually contain inconsistencies:
<a href="http://www.hustoninsurance.com/images/Showcases/Locations/99 Ashwood Rd/Group.png">
<img src="http://tiffinhealthexchange.com/images/Showcases/Locations/99 Ashwood Rd/Group.png" alt="Group.png"/></a>

Related

Make Pinterest Profile Widget Secure

I am using the below page to create a Pinterest Profile widget:
https://business.pinterest.com/en/widget-builder#do_embed_user
The problem is that when the widget displays the images use non secure links. I need to display the widget on a secure page so need them to be https://
Any ideas how I can go about this?
Ok so after a bit of research I have made a pretty intense hack to make this work. Pintrest does serve https content, it is just that for some reason they have not included this in their API. So I have stepped through the API and found the attribute setter that sets attributes to any elements the API creates.
Anyway.. here is the fiddle: https://jsfiddle.net/nanff007/1/ (make sure to https)
And here is the code that performs the magic...
This is a workaround/hack or whatever you want to call it. It will not work forever. It may also not work in all countries as the akamai urls may change. The best option would be to raise a request ticket with Pintrest.
(function() {
$('a[data-pin-do]').each(function () {
$(this).attr('data-pin-dont', $(this).attr('data-pin-do'));
$(this).removeAttr('data-pin-do');
});
var timer = setInterval(function () {
for (prop in window) {
if (prop.search(/^PIN_/) > -1 && typeof window[prop] != 'boolean') {
clearInterval(timer);
window[prop].f.set = function (el, att, string) {
if(att == 'src' && el.tagName.toLowerCase() == 'img') {
string = string.replace(/(^http:\/\/)/i, "https://s-");
}
if (typeof el[att] === 'string') {
el[att] = string;
} else {
el.setAttribute(att, string);
}
};
$('a[data-pin-dont]').each(function () {
$(this).attr('data-pin-do', $(this).attr('data-pin-dont'));
$(this).removeAttr('data-pin-dont');
});
window[prop].f.init();
break;
}
}
}, 100);
}());
Just Remove the https: and start with // as the beginning of the link.
For Example:
< a href="//sub-domain.example.com">Acme Widgets
Remove the spaces before > and after < in the above example

Opening .xul links in a new browser window

I have installed a FF extension called FireSSH which is basically a terminal in Firefox. When it runs the URL in the address bar is chrome://firessh/content/firessh.xul - I would like to make a link on a webpage that will open FireSSH but all atempts thus far have failed, for example I have tried:
<script>
function myFunction()
{
window.open("chrome://firessh/content/firessh.xul");
}
</script>
firessh>
and also:
firessh
and simply:
firessh
Any help appreciated.
B.
listen to all pages and when you find pages of interest, from your addon do,
var link = gBrowser.contentDocument.querySelector('#myLink');
link.addEventListener('click',openXulWindow,false);
//this openXulWindow opens a regular browser window
function openXulWindow() {
var sa = Cc["#mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
var wuri = Cc["#mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
wuri.data = 'http://www.bing.com/';
let aCharset = 'UTF-8';
let charset = Cc["#mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
charset.data = "charset=" + aCharset;
var aAllowThirdPartyFixup = false;
var allowThirdPartyFixupSupports = Cc["#mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
allowThirdPartyFixupSupports.data = aAllowThirdPartyFixup;
sa.AppendElement(wuri);
sa.AppendElement(charset);
sa.AppendElement(allowThirdPartyFixupSupports);
let features = "chrome,dialog=no,all";
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
features += ",private";
} else {
features += ",non-private";
}
Services.ww.openWindow(null, 'chrome://browser/content/browser.xul', null, features, sa);
}
Web content is not allowed to access, link and/or script chrome: content due to security concerns. chrome: runs at a higher security level, and allowing web content to unrestrictedly call into chrome: would essentially be a privilege escalation vulnerability.

Wordpress Create Category AJAX Response

I currently have a plugin that allows a user to activate/deactivate categories to drive a menu. I've created an option for the toggle and have it functioning in the create form and edit form seamlessly. The only place I can't seem to add it is to the AJAX return from wordpress when the category is created. I can create the column when the Categories page is loaded but don't know how to tap into the AJAX Return without modifying the core. Is there a hook that I'm unaware of that allows you to modify this return?
Using Akmal's answer, this is my script to check if the Taxonomy-Category was created or not.
Thanks Akmal.
Wordpress version 3.8.2
$(document).ajaxComplete(function(event, xhr, settings) {
var queryStringArr = settings.data.split('&');
if( $.inArray('action=add-tag', queryStringArr) !== -1){
var xml = xhr.responseXML;
$response = $(xml).find('term_id').text();
if($response!=""){
console.log('This is the action.');
}
}
});
Do you try to run some Javascript after ajax return (after add new category)?
Try to put below code in your code when you create the custom field in category form :
$(document).ajaxComplete(function(event, xhr, settings) {
var queryStringArr = settings.data.split('&');
if ($.inArray('action=add-tag', queryStringArr) !== -1){
your_javascript_function(); //this is your js function
}
});

firefox addon page-mod - when url doesn't match

I want to be able to activate a widget if a url matches some pattern, but the problem is I also want to disable the widget when page-mod rule doesn't match the url.
So if I have few tabs open and if I switch between them I should be able to somehow disable the widget if an active tab's url doesn't match the rule, or in other case activate it. The state of widget(on/off) should be changed on loading pages and switching through tabs.
I've been struggling with this for a while and still haven't found a solution.
This is where I'm at right now:
// Activates on matching one of the site domains, but I also want to deactivate
// it when it does not match
var pageMod = require("page-mod");
pageMod.PageMod({
include: ["*.site1.com","*.site2.com"],
onAttach: function() {
alert("Widget activated!");
});
});
Thank you for any help!
If I understand correctly what you are trying to do then page-mod is the wrong solution - you simply want to listen to the active tab. Use tabs module for that, listen to ready (new URL loaded) and activate (active tab changed) events:
var tabs = require("tabs");
tabs.on("ready", function(tab)
{
if (tab == tabs.activeTab)
updateActiveTab(tab);
});
tabs.on("activate", function(tab)
{
updateActiveTab(tab);
});
Your updateActiveTab() function would need to check tab.url and activate or deactivate the widget then. If you want to use patterns for that like the ones you specify for page-mod then you need to use the internal match-pattern module, like this:
var {MatchPattern} = require("match-pattern");
var patterns = [
new MatchPattern("*.site1.com"),
new MatchPattern("*.site2.com")
];
function updateActiveTab(tab)
{
var matches = false;
for (var i = 0; i < patterns.length; i++)
if (patterns[i].test(tab.url))
matches = true;
if (matches)
activateWidget();
else
deactivateWidget();
}
But of course you can just use a regular expression or something like this to test tab.url, you don't have to use the match-pattern module.
Disclaimer: The code examples are only there to make the approach easier to understand, they haven't been tested.

Is it possible to run something before DOMContentLoaded?

I want to inject stylesheets and scripts before DOMContentLoaded.
In Google Chrome it is possible using run_at = document_start.
Is there something similar in Firefox addons? Can I run things before gBrowser.addEventListener("DOMContentLoaded" ? How?
The current workaround I'm using is the following
gBrowser.addEventListener("DOMNodeInserted",
function (e)
{
if (typeof(e.relatedNode.tagName) != "undefined" &&
e.relatedNode.tagName == "DIV")
{
var window = e.relatedNode.ownerDocument.defaultView;
if (window.MyScript) return; // if it was injected
// ignore other events
if (/siteregex/i.test(window.location.href))
{
Initialize(window); // inject scripts
}
}
},
true);
DIV is the first element on body, so it will load right after this node. I won't have to wait for the whole page.

Resources