I've been following along on a few tutorials but have been running into examples that use deprecated code.
I'm trying to send the URL of the current tab to the popup.
My code thus far:
Manifest.json contains the proper permissions:
"permissions": [
"activeTab",
"tabs"
]
Popup.js, where I think the problem is but no errors in console.
function setup() {
noCanvas();
var url = 'URL'
function sendMessage() {
var msg = {
from: 'popup',
page: url
}
var params = {
active: true,
currentWindow: true
}
chrome.tabs.query(params, gotTabs);
function gotTabs(tabs) {
chrome.tabs.sendMessage(tabs[0].id, msg);
url = document.getElementById('currentLink').innerHTML;
console.log(url)
}
}
}
Popup.html
<body>
<h1>Popup Interface Example</h1>
<p id="currentLink">Loading ...</p>
</body>
What am I missing here?
I figured it out. Was making it WAY too hard.
Popup.js
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {
var url = tabs[0].url;
console.log(url);
document.getElementById("myText").innerHTML = url;
});
Popup.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Extension Pop-Up</title>
<script src="libraries/p5.js" type="text/javascript"></script>
<script src="libraries/p5.dom.js" type="text/javascript"></script>
<script src="popup.js" type="text/javascript"></script>
</head>
<body>
<h1>Wordnik Lookup</h1>
<p id="myText"></p>
</body>
</html>
i already add the plugin with cli
github.com.
and this my code
<button onclick="slide('right', 'dashboard.html')">back</button>
<script type="text/javascript">
function slide(direction,href) {
window.plugins.nativepagetransitions.slide(
{
'duration': 400,
'direction': direction,
'iosdelay': 50,
'androiddelay': 120,
'winphonedelay':800,
'href': href
},
function () {
console.log('slide transition finished');
});
}
</script>
and also i already add
<script type="text/javascript" src="cordova.js"></script>
this my complete code
pastebin.com
but is not working, i have error on console
exec proxy not found for NativePageTransitions
In JS you only have a 1:
function slide(href)
but in your html you have 2:
slide('right', 'dashboard.html')
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
includedLanguages: 'ar,de,en,nl,ru',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
<script src="https://translate.google.com/translate_a/element.js"></script>
<div id="google_translate_element"></div>
I want to show flags in google translater with language text?
I try to use jQuery file upload in a bootstrap modal with external content.
I've no problem with Firefox and Explorer, but with Chrome i've got this error
Cannot read property 'parseMetaData' of undefined
I include jQuery.js and jQuery.ui.min.js in main template and all other js directly in php page called by modal in this order:
<script src="//blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script>
<script src="//blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
<script src="//blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
<script src="js/jquery.iframe-transport.js"></script>
<script src="js/jquery.fileupload.js"></script>
<script src="js/jquery.fileupload-process.js"></script>
<script src="js/jquery.fileupload-image.js"></script>
<script src="js/jquery.fileupload-audio.js"></script>
<script src="js/jquery.fileupload-video.js"></script>
<script src="js/jquery.fileupload-validate.js"></script>
<script src="js/jquery.fileupload-ui.js"></script>
Then there is my code:
jQuery(function ($) {
'use strict';
$('#fileupload').fileupload({
autoUpload: true,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
maxFileSize: 8000000,
maxNumberOfFiles: 6,
disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator && navigator.userAgent),
imageMaxWidth: 1200,
imageMaxHeight: 900,
imageCrop: false,
url: '/wall/'
});
$('#fileupload').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
);
});
Anyone could help me?
i found the answer!
I've to include all the scripts in the header of main template.
Bye
I am using jQuery UI Calender for French Language.
But unfortunately I see the below error not sure if I am missing some thing.
Please advice.
Uncaught TypeError: Cannot read property 'regional' of undefined
JS :
/**
French initialisation for the jQuery UI date picker plugin.
**/
/* Written by Keith Wood (kbwood{at}iinet.com.au),
Stéphane Nahmani (sholby#sholby.net),
Stéphane Raimbault <stephane.raimbault#gmail.com> */
jQuery(function($){
$.datepicker.regional['fr'] = {
closeText: 'Fermer',
prevText: 'Précédent',
nextText: 'Suivant',
currentText: 'Aujourd\'hui',
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
dayNamesMin: ['D','L','M','M','J','V','S'],
weekHeader: 'Sem.',
dateFormat: 'dd/mm/yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['fr']);
});
Thanks!!
I'm guessing you forgot to include the localisation file:
<script src="https://jquery-ui.googlecode.com/svn-history/r3982/trunk/ui/i18n/jquery.ui.datepicker-nl.js"></script>
Source :Datepicker jQuery UI ... set language
Be sure to do not use ASYNC on script tags, because will fire this error.
Wrong:
<SCRIPT SRC="/includes/js/jquery/jquery-ui.js" TYPE="text/javascript" ASYNC></SCRIPT>
<SCRIPT SRC="/includes/js/jquery/jquery-datepicker-ptBR.js" TYPE="text/javascript" ASYNC></SCRIPT>
Right:
<SCRIPT SRC="/includes/js/jquery/jquery-ui.js" TYPE="text/javascript"></SCRIPT>
<SCRIPT SRC="/includes/js/jquery/jquery-datepicker-ptBR.js" TYPE="text/javascript"></SCRIPT>