Helper function that can be used in Component implementing Kwf_Media_Output_IsValidInterface
to check if the component is visible to the current user
979316
public static function isValid($id)
    {
        $writeCache = false;
        $cacheId = 'media-isvalid-component-'.$id;
        $plugins = Kwf_Cache_Simple::fetch($cacheId, $success);
        if ($success) {
            //success means it's VALID and we successfully fetched the $plugins
            $ret = Kwf_Media_Output_IsValidInterface::VALID;
        } else {
            $ret = Kwf_Media_Output_IsValidInterface::VALID;
            $c = Kwf_Component_Data_Root::getInstance()->getComponentById($id);
            if (!$c) {
                $c = Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
                if (!$c) return Kwf_Media_Output_IsValidInterface::INVALID;
                if (Kwf_Component_Data_Root::getShowInvisible()) {
                    //preview im frontend
                    $ret = Kwf_Media_Output_IsValidInterface::VALID_DONT_CACHE;
                } else if (Kwf_Registry::get('acl')->isAllowedComponentById($id, $c->componentClass, Kwf_Registry::get('userModel')->getAuthedUser())) {
                    //paragraphs preview in backend
                    $ret = Kwf_Media_Output_IsValidInterface::VALID_DONT_CACHE;
                } else if (Kwf_Registry::get('acl')->isAllowedUser(Kwf_Registry::get('userModel')->getAuthedUser(), 'kwf_component_preview', 'view')) {
                    //perview user in frontend
                    $ret = Kwf_Media_Output_IsValidInterface::VALID_DONT_CACHE;
                } else {
                    return Kwf_Media_Output_IsValidInterface::ACCESS_DENIED;
                }
            }
            //$ret can be VALID or VALID_DONT_CACHE at this point

            $plugins = array();
            $onlyInherit = false;
            while ($c) {
                $p = Kwc_Abstract::getSetting($c->componentClass, 'pluginsInherit');
                if (!$onlyInherit) {
                    $p = array_merge($p, Kwc_Abstract::getSetting($c->componentClass, 'plugins'));
                }
                foreach ($p as $plugin) {
                    if (is_instance_of($plugin, 'Kwf_Component_Plugin_Interface_Login')) {
                        $plugins[] = array(
                            'plugin' => $plugin,
                            'id' => $c->componentId
                        );
                    }
                }
                if ($c->isPage) {
                    $onlyInherit = true;
                }
                $c = $c->parent;
            }

            if ($ret == Kwf_Media_Output_IsValidInterface::VALID) {
                //only cache VALID, VALID_DONT_CACHE can't be cached
                $writeCache = true;
            }
        }

        foreach ($plugins as $p) {
            $plugin = $p['plugin'];
            $plugin = new $plugin($p['id']);
            if ($plugin->isLoggedIn()) {
                $ret = Kwf_Media_Output_IsValidInterface::VALID_DONT_CACHE;
            } else {
                $c = Kwf_Component_Data_Root::getInstance()->getComponentById($id);
                $userModel = Kwf_Registry::get('userModel');
                if (Kwf_Registry::get('acl')->isAllowedComponentById($id, $c->componentClass, $userModel ? $userModel->getAuthedUser() : null)) {
                    //allow preview in backend always
                    $ret = Kwf_Media_Output_IsValidInterface::VALID_DONT_CACHE;
                } else {
                    $ret = Kwf_Media_Output_IsValidInterface::ACCESS_DENIED;
                     break;
                }
            }
        }

        if ($writeCache && $ret == Kwf_Media_Output_IsValidInterface::VALID_DONT_CACHE) {
            //only cache VALID_DONT_CACHE, not VALID as it will be cached in Kwf_Media::getOutput
            //this cache doesn't need to be cleared, because of it's lifetime
            Kwf_Cache_Simple::add($cacheId, $plugins, 60*60-1); //one second less than isValid cache in Kwf_Media
        }
        return $ret;
    }
110052
def allowed_to_preview(user):
    
    if (
        user.is_authenticated and
        user.is_active and
        user.is_staff
    ):
        return True
    return False
614470
private String getReadonlyDisplayValue(final Object value, final UIInput component, final Converter converter) {
        if (value == null || "".equals(value)) {
            return "-";
        } else if (converter != null) {
            final String asString = converter.getAsString(FacesContext.getCurrentInstance(), component, value);
            return asString == null ? "-" : asString;
        }

        return String.valueOf(value);
    }
595237
protected boolean checkVisible() {

        return getHoverbar().getController().isEditable()
            && !CmsSitemapView.getInstance().isModelPageMode()
            && (!CmsSitemapView.getInstance().isGalleryMode() || getHoverbar().getController().getData().isGalleryManager());
    }
785169
private void updateButtonVisibility(CmsContainerPageElementPanel elementWidget) {

        Iterator<Widget> it = elementWidget.getElementOptionBar().iterator();
        while (it.hasNext()) {
            Widget w = it.next();
            if (w instanceof I_CmsGroupEditorOption) {
                if (((I_CmsGroupEditorOption)w).checkVisibility()) {
                    w.getElement().getStyle().clearDisplay();
                } else {
                    w.getElement().getStyle().setDisplay(Display.NONE);
                }
            }
        }
    }
1075996
def visible(self):
        
        delete = self._element.delete_
        if delete is None:
            return False
        return False if delete.val else True
778060
def is_available(self):
        
        if self.is_always_available:
            return True
        for viewname in self.__views__:
            if getattr(self, viewname).is_available():
                return True
        return False
340626
function(width) {

			var foundBrkpt = false;

			// look for existing breakpoint based on width
			for (var i = 0; i < mediaBreakpoints.length; i++) {

				// if registered breakpoint found, break out of loop
				if (width >= mediaBreakpoints[i]['enter'] && width <= mediaBreakpoints[i]['exit']) {
					foundBrkpt = true;

					break;
				}
			}

			// if breakpoint is found and it's not the current one
			if (foundBrkpt && curr !== mediaBreakpoints[i]['label']) {
				prev = curr;
				curr = mediaBreakpoints[i]['label'];

				// run the loop
				cycleThrough();

			// or if no breakpoint applies
			} else if (!foundBrkpt && curr !== '') {
				curr = '';

				// run the loop
				cycleThrough();
			}

		}
1293725
function handleWidgetVisibilityChange( newVisible, previousVisible ) {
               widgetIsVisible = newVisible;
               if( newVisible && previousVisible === false && showContent && options.animationsEnabled ) {
                  startWatchingForContentResizing();
               }
               else {
                  stopWatchingForContentResizing();
               }
            }
284703
def assert_visible(self, locator, msg=None):
        
        e = driver.find_elements_by_locator(locator)
        if len(e) == 0:
            raise AssertionError("Element at %s was not found" % locator)
        assert e.is_displayed()
66102
function getWHIgnoreDisplay(elem) {
  var val = undefined;
  var args = arguments;
  // in case elem is window
  // elem.offsetWidth === undefined
  if (elem.offsetWidth !== 0) {
    val = getWH.apply(undefined, args);
  } else {
    swap(elem, cssShow, function () {
      val = getWH.apply(undefined, args);
    });
  }
  return val;
}
1040203
function isFailX(elFuturePos, elRegion, visibleRect) {
  return elFuturePos.left < visibleRect.left ||
    elFuturePos.left + elRegion.width > visibleRect.right;
}
31249
def visibility_changed(self, enable):
        
        if self.dockwidget is None:
            return
        if enable:
            self.dockwidget.raise_()
            widget = self.get_focus_widget()
            if widget is not None and self.undocked_window is not None:
                widget.setFocus()
        visible = self.dockwidget.isVisible() or self.ismaximized
        if self.DISABLE_ACTIONS_WHEN_HIDDEN:
            toggle_actions(self.plugin_actions, visible)
        self.isvisible = enable and visible
        if self.isvisible:
            self.refresh_plugin()
815082
def confirm_value(self, widget):
        
        self.hide()
        params = (self.fileFolderNavigator.get_selection_list(),)
        return params
1179966
def confirm_value(self, widget):
        
        self.hide()
        params = (self.fileFolderNavigator.pathEditor.get_text(),)
        return params
1237531
function checkDeviceSupport(callback) {
            if (!canEnumerate) {
                if (callback) {
                    callback();
                }
                return;
            }

            if (!navigator.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) {
                navigator.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack);
            }

            if (!navigator.enumerateDevices && navigator.enumerateDevices) {
                navigator.enumerateDevices = navigator.enumerateDevices.bind(navigator);
            }

            if (!navigator.enumerateDevices) {
                if (callback) {
                    callback();
                }
                return;
            }

            MediaDevices = [];

            audioInputDevices = [];
            audioOutputDevices = [];
            videoInputDevices = [];

            hasMicrophone = false;
            hasSpeakers = false;
            hasWebcam = false;

            isWebsiteHasMicrophonePermissions = false;
            isWebsiteHasWebcamPermissions = false;

            // to prevent duplication
            var alreadyUsedDevices = {};

            navigator.enumerateDevices(function(devices) {
                devices.forEach(function(_device) {
                    var device = {};
                    for (var d in _device) {
                        try {
                            if (typeof _device[d] !== 'function') {
                                device[d] = _device[d];
                            }
                        } catch (e) {}
                    }

                    if (alreadyUsedDevices[device.deviceId + device.label]) {
                        return;
                    }

                    // if it is MediaStreamTrack.getSources
                    if (device.kind === 'audio') {
                        device.kind = 'audioinput';
                    }

                    if (device.kind === 'video') {
                        device.kind = 'videoinput';
                    }

                    if (!device.deviceId) {
                        device.deviceId = device.id;
                    }

                    if (!device.id) {
                        device.id = device.deviceId;
                    }

                    if (!device.label) {
                        device.label = 'Please invoke getUserMedia once.';
                        if (typeof DetectRTC !== 'undefined' && DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
                            if (typeof document !== 'undefined' && typeof document.domain === 'string' && document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
                                device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.';
                            }
                        }
                    } else {
                        if (device.kind === 'videoinput' && !isWebsiteHasWebcamPermissions) {
                            isWebsiteHasWebcamPermissions = true;
                        }

                        if (device.kind === 'audioinput' && !isWebsiteHasMicrophonePermissions) {
                            isWebsiteHasMicrophonePermissions = true;
                        }
                    }

                    if (device.kind === 'audioinput') {
                        hasMicrophone = true;

                        if (audioInputDevices.indexOf(device) === -1) {
                            audioInputDevices.push(device);
                        }
                    }

                    if (device.kind === 'audiooutput') {
                        hasSpeakers = true;

                        if (audioOutputDevices.indexOf(device) === -1) {
                            audioOutputDevices.push(device);
                        }
                    }

                    if (device.kind === 'videoinput') {
                        hasWebcam = true;

                        if (videoInputDevices.indexOf(device) === -1) {
                            videoInputDevices.push(device);
                        }
                    }

                    // there is no 'videoouput' in the spec.
                    MediaDevices.push(device);

                    alreadyUsedDevices[device.deviceId + device.label] = device;
                });

                if (typeof DetectRTC !== 'undefined') {
                    // to sync latest outputs
                    DetectRTC.MediaDevices = MediaDevices;
                    DetectRTC.hasMicrophone = hasMicrophone;
                    DetectRTC.hasSpeakers = hasSpeakers;
                    DetectRTC.hasWebcam = hasWebcam;

                    DetectRTC.isWebsiteHasWebcamPermissions = isWebsiteHasWebcamPermissions;
                    DetectRTC.isWebsiteHasMicrophonePermissions = isWebsiteHasMicrophonePermissions;

                    DetectRTC.audioInputDevices = audioInputDevices;
                    DetectRTC.audioOutputDevices = audioOutputDevices;
                    DetectRTC.videoInputDevices = videoInputDevices;
                }

                if (callback) {
                    callback();
                }
            });
        }
461453
def isVisible(self):
        
        in_node = self.inputNode()
        out_node = self.outputNode()

        if in_node and not in_node.isVisible():
            return False

        if out_node and not out_node.isVisible():
            return False

        return self._visible