Jump to content


Photo

Add Favoritos cross-browser


  • Faça o login para participar
4 replies to this topic

#1 puro osso sinistro

puro osso sinistro

    Turista

  • Usuários
  • 48 posts
  • Sexo:Não informado

Posted 21/07/2015, 12:11

Pessoal, eu desenvolvi esse código e ele funciona perfeitamente, porém como não conheço muito JAVASCRIPT, gostaria de saber se o código pode ficar mais elegante ou se existem melhorias que podem ser implementadas. Desde já agradeço a ajuda!

 

1 - Chamando a função

 

<a href="javascript:void(0)" onClick="return addFav(this);">clique aqui</a>.
 
2 - Função
 
<script language="JavaScript">
function addFav(a) 
{
 
 
 
/* 
Este script foi testado com sucesso nos seguintes navegadores:
IExplorer 9                                                                      
Firefox 38.0.5                                                                   
Google Chrome 43.0.2357.81 m                                                     
Opera 29.0.1795.60                                                               
Safari 5.1.7                                                                     
*/
 
 
 
// Setando variáveis básicas
pageTitle=document.title;
pageURL=document.location;
// Fim
 
 
 
// Detectando navegadores
 
// Setando variáveis para browsers diversos
var navegador = "Outro";
// Fim
 
// Internet Explorer
if(window.external && ('AddFavorite' in window.external))
{var navegador = "Internet Explorer";} 
// Fim
 
// Firefox
if ((window.sidebar && (navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) || (window.opera && window.print)) 
{var navegador = "Firefox";} 
// Fim
 
// Google Chrome
if (window.chrome) 
{var navegador = "Google Chrome";}
// Fim
 
// Opera
var ope = /OPR\/(\d+\.\d+)/i.test(navigator.userAgent);
if (ope)
{var navegador = "Opera";}
// Fim
 
// Safari
var saf = /^((?!chrome).)*safari/i.test(navigator.userAgent);
if (saf)
{var navegador = "Safari";}
// Fim
 
// Fim
 
 
 
// Setando Ação a ser tomada
 
// Internet Explorer (ALT+Z)
if(navegador == "Internet Explorer")
{
window.external.AddFavorite(pageURL, pageTitle);
// Fim
 
// Firefox (CONTROL+D)
else if(navegador == "Firefox")
{
a.rel='sidebar';
a.title=pageTitle;
a.href=pageURL;
window.external.AddFavorite(pageURL, pageTitle);
}
// Fim
 
// Google Chrome (CONTROL+D)
else if(navegador == "Google Chrome")
{
window.alert('Pressione as teclas CONTROLE+D para adicionar essa página no seu Favoritos.');
}
// Fim
 
// Opera (CONTROL+D)
else if(navegador == "Opera")
{
window.alert('Pressione as teclas CONTROLE+D para adicionar essa página no seu Favoritos.');
}
// Fim
 
// Safari (CONTROL+D)
else if(navegador == "Safari")
{
window.alert('Pressione as teclas CONTROLE+D para adicionar essa página no seu Favoritos.');
}
// Fim
 
// Outro
else if(navegador == "Outro")
{
window.alert('Pressione as teclas CONTROLE+D para adicionar essa página no seu Favoritos.');
}
// Fim
 
// Fim
 
 
 
return false;
 
 
 
}
</script>

 



#2 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 24/10/2017, 19:13

Orlistat In Colorado Co Doctor Cialis Generika Ohne Zollprobleme generic viagra Levitra Gesund Canada Pharmacy No Prescription Cialis 5mg Filmtabletten Bestellen

#3 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 04/11/2017, 16:40

Cialis Conditionnement Prix Berodual Without Prescription levitra without rx in the united states Priligy Plm Generic Zovirax Order India Buy Clomid Safely Online Uk Paypal
Order Antabuse Disulfiram Online Zithromax Pregnant Clomid Magasin L Homme bayer generic generic levitra 100mg Propecia Usp Ofloxacin Achat Propranolol

#4 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 25/11/2017, 23:00

Zithromax Time Frame Bentyl In Internet Tablets viagra Cialis E Cannabis Fish Amoxicillin Sales
Propecia Hair Loss Cream On Line Provera Gen buy viagra online Amoxicillin 500mg For Urinary Tract Infection
Acheter Cialis En Tunisie viagra Cialis Farmacia Tadalafil 20 Mg Without Prescription Generic Doryx Bacterial Infections Best Website

#5 JeffMalm

JeffMalm

    Super Veterano

  • Usuários
  • 12254 posts
  • Sexo:Feminino
  • Localidade:Mount Carey

Posted 09/02/2023, 14:34

Studies on prostate cancer 1 cialis otc Interestingly, those who started on doxorubicin containing regimens experienced fatigue immediately, while patients who received a combination therapy with CMF cyclophosphamide, methotrexate, and п¬âuorouracil did not report fatigue until after the п¬Ðfth cycle of chemotherapy
Using a good natural testosterone booster is also a great idea because dbol will suppress natural testosterone production finasteride Blood pressure drugs Heart rhythm drugs like digoxin Migraine drugs NSAIDs Antidepressants
cheap cialis generic online 695 percent after hitting a five week low of 1




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq