I`m using LessCSS, java, and colorbox. Colorbox has a css file. One of the styles is as follow:
.cboxIE6 #cboxMiddleRight {
_behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
}
it´s seems i´m need to use an escape character. When lesscss compiles the file, i getting the error
javax.servlet.ServletException: Parse Error: Syntax Error on line 77 (line 77, column 1) near
.cboxIE6 #cboxMiddleRight {
_behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
}
then i tried this..
.cboxIE6 #cboxMiddleRight {
_behavior: ~"expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split(\'\"\')[1], this.style.background = \"none\", this.style.filter = \"progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\" + this.src + \", sizingMethod=\'scale\')\")";
}
but. i get an error saying i´m missing a closing "}"
I don´t know how to solve this. Sure it´s a simple thing, but i can´t solve it.
Here is the java less css configuration (web.xml):
<servlet>
<servlet-name>less</servlet-name>
<servlet-class>com.asual.lesscss.LessServlet</servlet-class>
<init-param>
<param-name>compress</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cache</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>resource</servlet-name>
<servlet-class>com.asual.lesscss.ResourceServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>less</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
Any idea?
Thanks in advance.
This compiles fine for me:
.cboxIE6 #cboxMiddleRight {
_behavior: ~`this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')"`;
}
but it also tries executing the JavaScript at compile time. To avoid that, you could add another more quotes:
.cboxIE6 #cboxMiddleRight {
_behavior: ~`"\"this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('\\\"')[1], this.style.background = \\\"none\\\", this.style.filter = \\\"progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\\\" + this.src + \\\", sizingMethod='scale')\""`;
}
Though it looks ugly, it compiles down to this:
.cboxIE6 #cboxMiddleRight {
_behavior: "this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('\"')[1], this.style.background = \"none\", this.style.filter = \"progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\" + this.src + \", sizingMethod='scale')";
}
Related
I am trying to upload a file with a simple form. I can choose a file but when I click on "upload" nothing happens.
My FileUploader.view.xml is like:
<mvc:View
controllerName="sap.ui.unified.sample.FileUploaderBasic.Controller"
xmlns:l="sap.ui.layout"
xmlns:u="sap.ui.unified"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
class="viewPadding">
<l:VerticalLayout>
<u:FileUploader
id="fileUploader"
name="myFileUpload"
uploadUrl="upload/"
width="400px"
tooltip="Upload your file to the local server"
uploadComplete="handleUploadComplete"/>
<Button
text="Upload File"
press="handleUploadPress"/>
</l:VerticalLayout>
My Contoller.controller.js
sap.ui.define(['sap/m/MessageToast','sap/ui/core/mvc/Controller'],
function(MessageToast, Controller) {
"use strict";
var ControllerController = Controller.extend("sap.ui.unified.sample.FileUploaderBasic.Controller", {
handleUploadComplete: function(oEvent) {
var sResponse = oEvent.getParameter("response");
if (sResponse) {
var sMsg = "";
var m = /^\[(\d\d\d)\]:(.*)$/.exec(sResponse);
if (m[1] == "200") {
sMsg = "Return Code: " + m[1] + "\n" + m[2] + "(Upload Success)";
oEvent.getSource().setValue("");
} else {
sMsg = "Return Code: " + m[1] + "\n" + m[2] + "(Upload Error)";
}
MessageToast.show(sMsg);
}
},
handleUploadPress: function(oEvent) {
var oFileUploader = this.getView().byId("fileUploader");
oFileUploader.upload();
}
});
return ControllerController;
});
When I run this in the debugger I get an Uncaught TypeError:
Uncaught TypeError: Cannot read property '1' of null
at f.handleUploadComplete (FileUploader.controller.js?eval:11)
at f.a.fireEvent (EventProvider-dbg.js:229)
at f.a.fireEvent (Element-dbg.js:427)
at f.fireUploadComplete (ManagedObjectMetadata-dbg.js:426)
at HTMLIFrameElement.eval (FileUploader.js?eval:6)
at HTMLIFrameElement.dispatch (jquery-dbg.js:4737)
at HTMLIFrameElement.c3.handle (jquery-dbg.js:4549)
if (m[1] == "200") {
sMsg = "Return Code: " + m[1] + "\n" + m[2] + "(Upload Success)";
oEvent.getSource().setValue("");
I searched for sample code and it seems my code is ok, but I don't know why I can't upload a file by click on the button.
I solved this problem ! :)
So, instead of using this
var m = /^[(\d\d\d)]:(.)$/.exec(sResponse);
use this in view FileUploader :
sendXHR="true"
After, on controller js you can use for status :
oEvent.getParameter("status")
and for getting answer as a json file :
var jsonfile = JSON.parse(oEvent.getParameter("responseRaw"));
Then access your sent object attributes from server (only when use dataType: 'json')
jsonfile.attribute
I hope this helps a lot!
I want to open pdf file on click.
I tried below code but it didn't help me. It is giving error could not read file
var xhr = Ti.Network.createHTTPClient({
onload : function(e) {
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'file.pdf');
Ti.API.info('file == ' + f);
Ti.API.info('response = ' + this.responseData);
Ti.API.info('response = ' + JSON.stringify(this.responseData));
f.write(this.responseData);
Ti.API.info('write file == ' + f.write(this.responseData));
Ti.API.info('filepath == ' + f.nativePath);
Ti.API.info('get filepath == ' + f.getNativePath());
Ti.Android.currentActivity.startActivity(Ti.Android.createIntent({
action : Ti.Android.ACTION_VIEW,
type : 'application/pdf',
data : f.nativePath
}));
},
onerror : function(e) {
Alloy.Globals.loading.hide();
alert("Cannot retrieve PDF form web site");
},
timeout : 5000
});
xhr.open('GET', "https://www.mbta.com/uploadedfiles/Documents/Schedules_and_Maps/Rapid%20Transit%20w%20Key%20Bus.pdf");
xhr.send();
But I am getting Error as The document path is not valid.
I tried different way also using webview still not getting pdf on my app.
var win = Ti.UI.createWindow({
backgroundColor : '#fff'
});
var pdfViewer = Ti.UI.createWebView({
url : "http://lkn.ccomsys.com/assets/media/datafiles/gov/vvvv_Shehnai_Order1.pdf",
width : Titanium.UI.SIZE,
height : Titanium.UI.SIZE
});
Ti.API.info('pdfviewer == ' + JSON.stringify(pdfViewer));
win.add(pdfViewer);
win.open();
Thanks in advance.
I sorted this out
Step 1 : Created directory and file.
Step 2 : Write response to created file.
Step 3 : Open pdf with android intent.
Below is the complete code
var xhr = Ti.Network.createHTTPClient({
onload : function(e) {
Alloy.Globals.loading.hide();
var Settings = Titanium.Filesystem.getFile(Titanium.Filesystem.tempDirectory, 'Settings');
Ti.API.info("Created Settings: " + Settings.createDirectory());
Ti.API.info('Settings ' + Settings);
var newFile = Titanium.Filesystem.getFile(Settings.nativePath, 'Setting.pdf');
Ti.API.info('new file == ' + newFile);
if (newFile.exists() === false) {
// you don't need to do this, but you could...
newFile.write(this.responseData);
}
Ti.API.info('response = ' + this.responseData);
Ti.API.info('response = ' + JSON.stringify(this.responseData));
if (newFile.exists()) {
newFile.write(this.responseData);
Ti.API.info('newfile: ' + newFile.read());
}
Ti.Android.currentActivity.startActivity(Ti.Android.createIntent({
action : Ti.Android.ACTION_VIEW,
type : 'application/pdf',
data : newFile.nativePath
}));
},
onerror : function(e) {
Alloy.Globals.loading.hide();
alert("Cannot retrieve PDF form web site");
},
timeout : 5000
});
xhr.open('GET', "https://www.mbta.com/uploadedfiles/Documents/Schedules_and_Maps/Rapid%20Transit%20w%20Key%20Bus.pdf");
xhr.send();
I'm trying to highlight specific dates in an array in Bootstrap's Datepicker and am unable to make it work. I would like to have something like the code below and can't find any examples. Does anyone know how to make this work?
var dateValues = ['1/01/2015', '1/14/2015', '1/19/2015']
$('#events-calendar').datepicker({
highlightDates = dateValues
)}
I ended up having to add the feature myself, couldn't figure out any other way to do it.
The array looks something like this:
[
{ "Class": "fault", "Date": "1995-06-23" },
{ "Class": "fault", "Date": "2014-05-01" },
{ "Class": "fault", "Date": "2015-06-17" },
{ "Class": "fault", "Date": "2015-06-14" }
]
Added the following to my options.
var options = {
highlights: allBindings.datetimepicker.attr.highlights || []
};
Inserted the following code inside bootstrap-datetimepicker.js in the while loop of the 'fillDate' function:
var cssClass = "";
try {
for (var j = 0; j < options.highlights.length; j++) {
var current = options.highlights[j];
if (current.Date == prevMonth._d.yyyymmdd()) {
cssClass = "faulted";
break;
} else {
cssClass = "";
}
}
} catch (e) {
console.log('Date pick date highlighter" ' + e);
}
And then I changed the following line:
row.append('<td class="day' + clsName + '">' + prevMonth.date() + '</td>');
to:
row.append('<td class="day' + clsName + ' ' + cssClass + '">' + prevMonth.date() + '</td>');
You can modify your 'faulted' class to any color you want. But mine looks like this:
.faulted {
background-color: red !important;
}
Out put looks like this:
Good morning,
A former colleague of mine had created an application where you could search by zipcode and then placed markers on the map (google maps) in a radius of 5-40 km.
The locations are stores in a radius of 40 km from the zip code where you are looking for.
The function itself is still working only the info window with the information does not work anymore.
I have several websites running with this application but for all sites the infowindow is not working anymore. Could it be that Google itself has made adjustments in the api and I also need to adjust something somewhere?
This is the code that my colleague has put together and there is nothing changed but it does not work anymore ... Is there someone here know anything about the problem because I can not figure out myself..
<script type="text/javascript">
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var myOptions = {
zoom: <?php
if(is_array($postcodevelden) && count($postcodevelden) > 0 && !empty($_POST['address']))
{
switch($radius)
{
case "5":
echo "12";
break;
case "10":
echo "11";
break;
case "15":
case "20":
echo "10";
break;
case "30":
case "40":
echo "9";
break;
}
}
else
{
echo "7";
}
?>,
center: new google.maps.LatLng(<?php if(is_array($postcodevelden) && count($postcodevelden) > 0) { echo $lat.", ".$lon; } else { echo "52.2008737173322, 5.25146484375"; } ?>),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
<?php
if(is_array($adressen) AND count($adressen) > 0)
{
foreach($adressen as $adres)
{
$afstand = round((6371 * acos(sin(deg2rad($lat)) * sin(deg2rad($adres->locatie_lat)) + cos(deg2rad($lat)) * cos(deg2rad($adres->locatie_lat)) * cos(deg2rad($adres->locatie_lon) - (deg2rad($lon))))), 2);
?>
addMarker(<?php echo $adres->locatie_lat.", ".$adres->locatie_lon.", '".$adres->locatie_naam."', '".$adres->locatie_straat."', '".$adres->locatie_postcode."', '".$adres->locatie_plaats."', '".$adres->locatie_telefoon."', '".$afstand."'"; ?>);
<?php
}
}
?>
}
var infowindow = new google.maps.InfoWindow();
function addMarker(lat, lon, naam, straat, postcode, plaats, telefoon, afstand)
{
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lon),
map: map,
icon: "images/pincard/wheel-icon.png",
title: naam
});
google.maps.event.addListener(marker, 'mouseover', function() {
var contentString = '<div>'+
'<b style="border-bottom: 1px solid #000000;">' + naam + '</b><br/>'+
'Afstand (hemelsbreed): ' + afstand + ' km<br/>' +
straat + '<br/>' +
postcode + ' ' + plaats + '<br/>';
if(telefoon != "")
{
contentString = contentString + 'Telefoonnr: ' + telefoon;
}
contentString = contentString + '</div>';
infowindow.content = contentString;
infowindow.open(map, marker);
});
google.maps.event.addListener(marker, 'mouseout', function(){
infowindow.close(map);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
I call the api like this:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
If anyone has any idea why the info window to all websites stops working then I would love to hear that because I do not understand why it no longer works.
Thanks in advance for any effort
Kind regards,
Joep
PS: this is a website for example:
intertyre...php?lang=nl&p=4
I was bitten by the same problem and went Googling for an answer.
Found the answer to my problem -- it looks like Google may have tightened up its infoWindow API a bit forcing you to set
the .content member via a proper Set() function.
Try replacing the line
infowindow.content = contentString;
with
infowindow.setContent(contentString);
and see if that helps. I did that with my code and that fixed the breakage.
I'm getting an error from mediaelement-and-player.min.js:
Line: 44
Error: Unexpected call to method or property access.
I'm trying to use the player in a webpart in Sharepoint 2010. The example I'm trying out is the YouTube example.
Here are my code snippets cut out from the webpart.
jQuery is loaded by the masterpage in SP2010.
Loading plugins:
this.Controls.Add(new CssRegistration() { Name = "/_layouts/Script/mediaelement/mediaelementplayer.css", EnableCssTheming = true });
this.Controls.Add(new ScriptLink { Name = "/_layouts/Script/mediaelement/mediaelement-and-player.min.js", Language = "javascript", Localizable = false, LoadAfterUI = true });
this.Controls.Add(new ScriptLink { Name = "/_layouts/Script/video.js", Language = "javascript", Localizable = false, LoadAfterUI = true });
HTML code:
writer.Write("<video width='320' height='240' id='player1' >");
writer.Write(" <!-- Pseudo HTML5 -->");
writer.Write(" <source src='" + VideoPickerUrl + "' type='video/youtube' />");
writer.Write("</video>");
writer.Write("<span id='player1-mode'></span>");
Javascript code:
$("video").mediaelementplayer({
enablePluginDebug: true,
pluginPath: '/_layouts/Script/mediaelement/',
flashName: 'flashmediaelement.swf',
success: function (media, node, player) {
$('#' + node.id + '-mode').html('mode: ' + media.pluginType);
},
error: function () {
$('#' + node.id + '-mode').html('Noe er feil!');
}
});
Edit:
When trying the NOT .min js file, I'm also getting the error on line 970. The code stops at the if statement:
for (i=0; i<mediaFiles.length; i++) {
// normal check
if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
// special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
result.method = 'native';
result.url = mediaFiles[i].url;
break;
}
}
Do you have any tips on what I'm doing wrong?
Best regards
Anders