Control Qualtrics Mobile Devices - qualtrics

I want to block mobile device respondent.
So i want to hide next button who use mobile device.
Or I want to get your advice.
Please help me.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place Your JavaScript Here*/
});

Your best option is to check for a mobile user agent:
Qualtrics.SurveyEngine.addOnload(function()
{
window.mobilecheck = function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
return check;
};
if (window.mobilecheck()===false) {
// Not Moble
} else {
// Mobile
}
});
The window.mobilecheck function was sourced from: Detecting a mobile browser.
The code works in Qualtrics. Insert whatever it is you want to do when window.mobilecheck is true or false where marked.

Related

How to move a Javascript <script> that was placed after an </html> tag in Wordpress

I have a Wordpress site that I inherited and I am getting a malware warning in SiteGround.
MATCHED: http://labs.sucuri.net/db/malware/warning.html_anomaly?2
<script>jQuery('.gform_wrapper ul li.gfield').removeClass('gfield');
I don't know the history of the site so i don't know where this script came from.
Looking at my page's source code I see this:
...</body></html></main> <script>jQuery('.gform_wrapper ul li.gfield').removeClass('gfield');
jQuery(window).bind("load", function () {
jQuery('.product-tab .common-tab').each(function () {
var highestBox = 0;
jQuery('.common-tab-box', this).each(function () {
if ($(this).height() > highestBox)
highestBox = $(this).outerHeight();
});
jQuery('.common-tab-box', this).height(highestBox);
});
jQuery('.tab-click').on('click', function () {
jQuery(this).addClass('active-tab').siblings().removeClass('active-tab');
jQuery('.common-tab').hide();
jQuery('#tab-section-' + $(this).data('target')).fadeIn('fast');
});
jQuery('.tab-click').first().click();
});
function addBoxshadowToMenu() {
var scroll = $(window).scrollTop();
if (scroll > 0) {
$("nav.navbar").addClass('has-shadow');
} else {
$("nav.navbar").removeClass('has-shadow');
}
}
mobilecheck = function () {
var check = false;
(function (a) {
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true;
})(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
jQuery(document).ready(function () {
addBoxshadowToMenu();
window.onscroll = function () {
addBoxshadowToMenu();
};
if (mobilecheck()) {
jQuery(".mounting-section .mouting-header p").find('br').remove();
jQuery(".video-section .container .header p").find('br').remove();
jQuery(".contact-section .container .section-content h2").find('br').remove();
}
});</script>
Upon reading about this warning, it looks like I need to move the javascript before the /html tag.
Questions:
Is this malware?
How do I move this script? I looked at the file manager for this site and I can't find the file that would allow me to move this.
Thank you for your help.
If they truly injected malware its likely there is also a backdoor into your website, the script your linking in here is not malware, however if there is malware injected in the website, i would recommend either beginning from scratch with a new website, or have a specialized company remove the malware.
edit: Perhaps you can link your website so i can check out the sourcecode

Change width of Qt Maintenance Tool window?

I want to make the maintenance tool window wider. Users are confused by the version page, as it is truncated and they do not see what the new version is.
I tried making a really long title description, but that did not work.
I have not found a scripting solution, but here is my installscript.js
function Component()
{
}
Component.prototype.isDefault = function()
{
// select the component by default
return true;
}
Component.prototype.createOperations = function()
{
try {
component.createOperations();
if (installer.value("os") === "win") {
component.addOperation("CreateShortcut", "#TargetDir#/winnow.exe", "#StartMenuDir#/Winnow.lnk");
}
} catch (e) {
console.log(e);
}
}
Use WizardDefaultWidth WizardDefaultHeight in config.xml
see http://doc.qt.io/qtinstallerframework/ifw-globalconfig.html

Redirect users visiting mobile site from desktop

i created 2 different website, one for mobile and one for desktop using Wordpress! I used a plugin called equivalent mobile redirect in order to redirect mobile users to the mobile site when they visit the desktop one! Now i need to do this vice versa and i cannot seem to find a efficient way! Any ideas?
You can check with javascript:
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if(isMobile.any()){
// Mobile!
} else {
// Desktop
}
Take a look at this code if you don't want to use Javascript. You can use WordPress's detect mobile function to redirect if visitor is on desktop browser.
if(!wp_is_mobile()){
// If not using mobile
wp_redirect( "https://your_desktop_site.com");
exit;
}
You can add this code to your theme's functions.php file and it will work.

if user login show **logintemplate ` in meteor otherwise show `index template`?

if user login show logintemplate in meteor otherwise show index template.I want when user login show the after login page it is ok .But i am asking when we are give at web url afterlogin template like(/admin) it will open i want when ever we give /admin show the home page not showing admin page.plz suggest me.
Maybe you are looking this.
With JSCode.
Router.route('/', function () {
if(Meteor.userId(){
this.render('loginTemplate');
}else{
this.render('login')
}
});
Using Spacebars.
{{#if currentUser}}
{{> loginTemplate}}
{{else}}
{{> login}}
{{/if}}
Using onBeforeAction
First The function
var requireLogin = function() {
if (! Meteor.user()) {
if (Meteor.loggingIn()) {
this.render(this.loadingTemplate);
} else {
this.render('accessDenied');
}
} else {
this.next();
}
}
Second onBeforeAction
Router.onBeforeAction(requireLogin, {only: 'loginTemplate'}); // this will only been applied to the `loginTemplate`.

Graphicsmagick package error

I'm trying to use the cfs:graphicsmagick package to generate thumbnails but all that is generated is an empty image.
When I start the server things look good:
I20150108-10:43:14.698(-8)? => GraphicsMagick found
I20150108-10:43:14.901(-8)? available
=> Meteor server restarted
but it seems gm is not available:
if (gm.isAvailable) {
console.log("gm is available");
}
and the console throws out an error:
Uncaught TypeError: Cannot read property 'isAvailable' of undefined
Look into docs, seems like the gm scope its just available on the server side, so there is not problem here, you are having the console.log, pretty find
now you can use, on the fsCollection like this
Images = new FS.Collection("images", {
stores: [
new FS.Store.FileSystem("images"),
new FS.Store.FileSystem("thumbs", {
transformWrite: function(fileObj, readStream, writeStream) {
// Transform the image into a 10x10px thumbnail
gm(readStream, fileObj.name()).resize('10', '10').stream().pipe(writeStream);
}
})
],
filter: {
allow: {
contentTypes: ['image/*'] //allow only images in this FS.Collection
}
}
});
remember gm its just available on the server, so use it on /server or use on if(isServer)
Try this
if (Meteor.isServer) {
if (gm.isAvailable) {
console.log("gm is available and this console.log was printed from my own code");
}
}
Tell me if works
Update answer
If you are declaring FS.collection on both server/client i recommend you declare collection on /lib/collection.js like this
//collections.js
Adopcion = new FS.Collection("Adopcion", {
stores: [
new FS.Store.FileSystem("images"),
new FS.Store.FileSystem("thumbs", {
transformWrite: function(fileObj, readStream, writeStream) {
// Transform the image into a 10x10px thumbnail
gm(readStream, fileObj.name()).resize('10', '10').stream().pipe(writeStream);
}
})
]
});
and on the same file make the subscription
//collection.js
//Subscribe
if(Meteor.isClient) {
Meteor.subscribe('Adopcion');
}
And now on /server/publish.js you only make the publish function
//Publish methods
Meteor.publish('Adopcion', function(){
return Adopcion.find();
});
With that there is no need of Meteor.methods({}) and the first thing meteor will load its the collection, and they will be available on both client/server
Take a look and tell me if works for you

Resources